This is happening because, when we create a new Sales order using AIFservice, TheMaine Sales Order class checks, is this the first sales order given by the customer, if so, then it put its order type = Sales Order but if the sales order is for a second or more time from the same customer than it put its order type= Journal. It checks all this with the help of PurchOrderFormNum field which is mandatory for creating sales orders from AIF. So the solution for it is to comment some code.
for that you need to go AOT-->Classes-->AxdSalesOrder-->prepareSalesTable() method and comment following code.
if (!_axSalesTable.salesTable())
{
createRecord = true;
_axSalesTable.parmSalesType(this.salesType());
select firstonly RecId from localSalesTable
where localSalesTable.CustAccount == _axSalesTable.parmCustAccount()
&& localSalesTable.PurchOrderFormNum == _axSalesTable.parmPurchOrderFormNum()
&& localSalesTable.SalesId != _axSalesTable.parmSalesId();
// if (localSalesTable.RecId)
// {
// _axSalesTable.parmSalesType(SalesType::Journal);
// }
.
.
.
}
Then, update service . Redeploy it and use it in your C# program. It will solve your problem.
//************************************** And Then *********************************************
To work around this problem, change the code in the first line after the hanging semicolon of the \Classes\AxdSalesOrder\prepareSalesTable object as follows.
Existing code
_axSalesTable.parmSalesType(this.salesType());
Replacement code
if(enum2int(_axSalesTable.parmSalesType()) == 3)
_axSalesTable.parmSalesType(SalesType::Sales);
else
_axSalesTable.parmSalesType(this.salesType());
///******************************************************
set the sales order parameter to "Sales Order" under the following path :-
Accounts receivable -> Setup -> Accounts receivable Parameters -> AIF -> Order Type
ليست هناك تعليقات:
إرسال تعليق