Either debit or credit amount is required for Debtors - CPXZ

raise raise_exception, encode(msg)\nValidationError: Sales Invoice SINV-00017: Either debit or credit amount is required for Debtors - CPXZ\n"]","_server_messages":"["{\“message\”: \“Sales Invoice SINV-00017: Either debit or credit amount is required for Debtors - CPXZ\”, \“indicator\”: \“red\”}"]"}

Looks like you are not entering or passing the invoice amount in your request message or data entry

What is the name of the field I should pass the amount to?

It depends on what you are trying to achieve, you can see the field names in the doc type from Customize Form, for eg: total_billing_amount

I check everything. I miss something. Please someone help me.

This is the code to upload invoice

1 invoice header
new_erp_salesinvoice.Data.items = jinvoicelist
new_erp_salesinvoice.Data.title = jihlist(0).invoicenumber & “-” & jihlist(0).companyname & “-” & jihlist(0).invoicedate
new_erp_salesinvoice.Data.naming_series = “SINV-”
new_erp_salesinvoice.Data.name = “SINV-” & jihlist(0).invoicenumber
new_erp_salesinvoice.Data.customer_name = jihlist(0).companyname
new_erp_salesinvoice.Data.customer = jihlist(0).companyname
new_erp_salesinvoice.Data.is_pos = 1
new_erp_salesinvoice.Data.is_return = 0
new_erp_salesinvoice.Data.update_stock = 1
new_erp_salesinvoice.Data.offline_pos_name = “SINV-” & jihlist(0).invoicenumber
new_erp_salesinvoice.Data.posting_date = jihlist(0).invoicedate
new_erp_salesinvoice.Data.due_date = jihlist(0).duedate
new_erp_salesinvoice.Data.selling_price_list = “Standard Selling” 'jihlist(0).pricelist
new_erp_salesinvoice.Data.price_list_currency = defaultcustomervar(0).currency
new_erp_salesinvoice.Data.total_billing_amount = jihlist(0).invoicetotal
new_erp_salesinvoice.Data.base_total = jihlist(0).subtotal
new_erp_salesinvoice.Data.base_net_total = jihlist(0).subtotal
new_erp_salesinvoice.Data.net_total = jihlist(0).subtotal
new_erp_salesinvoice.Data.total = jihlist(0).subtotal
'new_erp_salesinvoice.Data.taxes = jtax
new_erp_salesinvoice.Data.taxes_and_charges = “GCT” 'jihlist(0).tax1name
new_erp_salesinvoice.Data.apply_discount_on = “Net Total”
new_erp_salesinvoice.Data.payments = jinvoicepayment
new_erp_salesinvoice.Data.account_for_change_amount = jaccountsetup_Cash(0).iaccountname
new_erp_salesinvoice.Data.debit_to = jaccountsetup_Debtors(0).iaccountname
new_erp_salesinvoice.Data.against_income_account = jaccountsetup_Sales(0).iaccountname
new_erp_salesinvoice.Data.import_status = “U”
new_erp_salesinvoice.Data.status = “Paid”
new_erp_salesinvoice.Data.submit_on_creation = 1
new_erp_salesinvoice.Data.joogle_invoice = jihlist(0).invoicenumber
new_erp_salesinvoice.Data.docstatus = 1

This is the code for the detail record

Public Class InvoiceDetailManager : Inherits ConnectionHandler
Function InvoiceDetailData(ByRef invoicenumber As String) As List(Of InvoiceDetail)
InvoiceDetailData = New List(Of InvoiceDetail)
Dim sqltext As String = “select * from invoicedetail where (importstatus = ‘U’) And (invoicenumber = @invoicenumber) "
Using cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand() _
With {.CommandText = sqltext, .Connection = sqlcon}
cmd.Parameters.AddWithValue(”@invoicenumber", invoicenumber)

            If sqlcon.State <> ConnectionState.Open Then
            End If
            Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
            While dr.Read
                Dim findinvoiceprint As New InvoiceDetail() With {.qty = dr("quantity").ToString,
                                                                    .quantity = dr("quantity").ToString,
                                                                       .rate = dr("listprice").ToString,
                                                                       .base_rate = dr("unitprice").ToString,
                                                                       .base_amount = dr("extended").ToString,
                                                                        .stock_uom = dr("uom").ToString,
                                                                        .item_code = dr("itemnumber").ToString,
                                                                        .item_name = dr("itemname").ToString,
                                                                       .description = dr("description").ToString,
                                                                       .income_account = "Sales - CPXZ",
                                                                       .cost_center = "Main - CPXZ",
                                                                       .expense_account = "Cost of Goods Sold - CPXZ",
                                                                       .item_tax_rate = dr("item_tax_rate").ToString,
                                                                       .barcode = dr("upccode").ToString,
                                                                        .amount = dr("extended").ToString}

            End While
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Print Invoice Manager Say")
                If sqlcon.State = ConnectionState.Open Then
                End If
            Catch ex As Exception
                MsgBox("Error closing connection")
            End Try
        End Try
    End Using
End Function

What am I missing. If i set the docstatus = 0 the that same invoice am try to post via the API will upload as draft and i can post it however if i try to post from the api am getting the same exception.

Sales Invoice SINV-00039: Either debit or credit amount is required for Debtors - CPXZ\n"]","_server_messages":"["{\“message\”: \“Sales Invoice SINV-00039: Either debit or credit amount is required for Debtors - CPXZ\”, \“indicator\”: \“red\”}"]"}

Seems you may need to include payment details info when update_stock = 1