@rmehta This is an issue for me too where we have written our App for selling to customers but all the Invoices are getting saved as Draft instead of Paid & inventory is not being deducted.
My code :-
String requiredBody = "https://tooracart.erpnext.com/api/resource/Sales%20Invoice";
String data = "{" +
Utility.setdoubleQuote("naming_series") + ":" + Utility.setdoubleQuote(SalesInvoiceSeries) + "," +
Utility.setdoubleQuote("customer") + ":" + Utility.setdoubleQuote(cstmr) + "," +
Utility.setdoubleQuote("customer_name") + ":" + Utility.setdoubleQuote(cstmr) + "," +
Utility.setdoubleQuote("is_pos") + ":" + Utility.setdoubleQuote("1") + "," +
Utility.setdoubleQuote("company") + ":" + Utility.setdoubleQuote(company) + "," +
Utility.setdoubleQuote("posting_date") + ":" + Utility.setdoubleQuote(Utility.getCurrentDate()) + "," +
Utility.setdoubleQuote("due_date") + ":" + Utility.setdoubleQuote(Utility.getCurrentDate()) + "," +
// Utility.setdoubleQuote(“is_return”) + “:” + Utility.setdoubleQuote(“0”) + “,” +
Utility.setdoubleQuote(“currency”) + “:” + Utility.setdoubleQuote(“INR”) + “,” +
Utility.setdoubleQuote(“selling_price_list”) + “:” + Utility.setdoubleQuote(sellingPricelist) + “,” +
Utility.setdoubleQuote(“price_list_currency”) + “:” + Utility.setdoubleQuote(“INR”) + “,” +
Utility.setdoubleQuote(“update_stock”) + “:” + Utility.setdoubleQuote(“1”) + “,” +
Utility.setdoubleQuote(“discount_amount”) + “:” + getDiscountAmount() + “,” +
Utility.setdoubleQuote(“apply_discount_on”) + “:” + Utility.setdoubleQuote(“Grand Total”) + “,” +
Utility.setdoubleQuote(“cash_bank_account”) + “:” + Utility.setdoubleQuote(CashAccount) + “,” +
Utility.setdoubleQuote(“write_off_amount”) + “:” + “0.0” + “,” +
Utility.setdoubleQuote(“debit_to”) + “:” + Utility.setdoubleQuote(DebitedTo) + “,” +
// Utility.setdoubleQuote(“party_account_currency”) + “:” + Utility.setdoubleQuote(“INR”) + “,” +
Utility.setdoubleQuote(“remarks”) + “:” + Utility.setdoubleQuote(“via b2b mobile app”) + “,” +
Utility.setdoubleQuote(“customer_group”) + “:” + Utility.setdoubleQuote(“Individual”) + “,” +
Utility.setdoubleQuote(“submit_on_creation”) + “:” + Utility.setdoubleQuote(“1”) + “,” +
Utility.setdoubleQuote(“against_income_account”) + “:” + Utility.setdoubleQuote(IncomeAccount) + “,” +
Utility.setdoubleQuote(“paid_amount”) + “:” + total_amount.getText().toString() + “,” +
Utility.setdoubleQuote(“mode_of_payment”) + “:” + Utility.setdoubleQuote(“Cash”) + “,” +
Utility.setdoubleQuote(“is_opening”) + “:” + Utility.setdoubleQuote(“No”) + “,” +
Utility.setdoubleQuote(“status”) + “:” + Utility.setdoubleQuote(“Paid”) + “,” +
Utility.setdoubleQuote(“amount_received”) + “:” + Utility.setdoubleQuote(amountReceived.getText().toString()) + “,” +
Utility.setdoubleQuote(“amount_returned”) + “:” + Utility.setdoubleQuote(amountReturn.getText().toString()) + “,” +
Utility.setdoubleQuote(“items”) + “:[”;
String ItemBody = "{" +
Utility.setdoubleQuote("item_code") + ":" + Utility.setdoubleQuote(tempdb.getallCheckout(client).get(0).getProductCode()) + "," +
Utility.setdoubleQuote("item_name") + ":" + Utility.setdoubleQuote(tempdb.getallCheckout(client).get(0).getProductName()) + "," +
Utility.setdoubleQuote("qty") + ":" + Utility.setdoubleQuote(tempdb.getallCheckout(client).get(0).getProductQuantity().replace(" kg", "")) + "," +
Utility.setdoubleQuote("rate") + ":" + Utility.setdoubleQuote(tempdb.getallCheckout(client).get(0).getProductPrice()) + "," +
// Utility.setdoubleQuote(“income_account”) + “:” + Utility.setdoubleQuote(IncomeAccount) + “,” +
Utility.setdoubleQuote(“expense_account”) + “:” + Utility.setdoubleQuote(ExpenseAccount) + “,” +
Utility.setdoubleQuote(“cost_center”) + “:” + Utility.setdoubleQuote(costCenter) + “,” +
Utility.setdoubleQuote(“warehouse”) + “:” + Utility.setdoubleQuote(warehouse) + “,” +
Utility.setdoubleQuote(“parenttype”) + “:” + Utility.setdoubleQuote(“Sales%20Invoice”) + “,” +
Utility.setdoubleQuote(“parentfield”) + “:” + Utility.setdoubleQuote(“items”) + “}”;
String PaymentBody = "]," +
Utility.setdoubleQuote("payments") + ":[{" +
Utility.setdoubleQuote("mode_of_payment") + ":" + Utility.setdoubleQuote("Cash") + "," +
Utility.setdoubleQuote("amount") + ":" + amount.getText().toString() + "," +
Utility.setdoubleQuote("account") + ":" + Utility.setdoubleQuote(CashAccount) +
"}]";
String ClosingBody = "}";