Change the code in the Controls in the Manual vendor Payment Line form (12188) as follows:
Existing code 1...
InPage=0;
CaptionML=ENU=Withholding Tax Code;
SourceExpr=WithholdingTaxCode;
TableRelation="Withhold Code" }
{ 1130006;Label ;440 ;2090 ;3300 ;440 ;ParentControl=1130005 }
// Delete the following line.
{ 1130007;TextBox ;13090;3190 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Vendor Bank Account;
SourceExpr=VendorBankAccount;
TableRelation="Vendor Bank Account";
OnLookup=VAR
...
Replacement code 1...
InPage=0;
CaptionML=ENU=Withholding Tax Code;
SourceExpr=WithholdingTaxCode;
TableRelation="Withhold Code" }
{ 1130006;Label ;440 ;2090 ;3300 ;440 ;ParentControl=1130005 }
// Add the following line.
{ 1130007;TextBox ;13090;3740 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Vendor Bank Account;
SourceExpr=VendorBankAccount;
TableRelation="Vendor Bank Account";
OnLookup=VAR
...
Existing code 2...
IF FORM.RUNMODAL(FORM::"Vendor Bank Account List",VendBankAcc,VendBankAcc.Code) = ACTION::LookupOK THEN
VendorBankAccount := VendBankAcc.Code;
// IT0001.end
END;
}
// Delete the following line.
{ 1130008;Label ;9680 ;3190 ;3300 ;440 ;ParentControl=1130007 }
{ 1130009;TextBox ;3850 ;3190 ;5500 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Description;
SourceExpr=Desc }
{ 1130010;Label ;440 ;3190 ;3300 ;440 ;ParentControl=1130009 }
...
Replacement code 2...
IF FORM.RUNMODAL(FORM::"Vendor Bank Account List",VendBankAcc,VendBankAcc.Code) = ACTION::LookupOK THEN
VendorBankAccount := VendBankAcc.Code;
// IT0001.end
END;
}
// Add the following line.
{ 1130008;Label ;9680 ;3740 ;3300 ;440 ;ParentControl=1130007 }
{ 1130009;TextBox ;3850 ;3190 ;5500 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Description;
SourceExpr=Desc }
{ 1130010;Label ;440 ;3190 ;3300 ;440 ;ParentControl=1130009 }
...
Existing code 3...
{ 1130013;TextBox ;13090;990 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Total Amount;
SourceExpr=TotalAmount }
{ 1130014;Label ;9680 ;990 ;3300 ;440 ;ParentControl=1130013 }
// Delete the following line.
{ 1130015;TextBox ;13090;1540 ;2200 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document Type;
OptionCaptionML=ENU=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund";
OptionString=[ ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund];
SourceExpr=DocumentType }
...
Replacement code 3...
{ 1130013;TextBox ;13090;990 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Total Amount;
SourceExpr=TotalAmount }
{ 1130014;Label ;9680 ;990 ;3300 ;440 ;ParentControl=1130013 }
// Add the following line.
{ 1130015;TextBox ;13090;2090 ;2200 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document Type;
OptionCaptionML=ENU=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund";
OptionString=[ ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund];
SourceExpr=DocumentType }
...
Existing code 4...
InPage=0;
CaptionML=ENU=Document Type;
OptionCaptionML=ENU=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund";
OptionString=[ ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund];
SourceExpr=DocumentType }
// Delete the following lines.
{ 1130016;Label ;9680 ;1540 ;3300 ;440 ;ParentControl=1130015 }
{ 1130017;TextBox ;13090;2090 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document No.;
SourceExpr=DocumentNo }
{ 1130018;Label ;9680 ;2090 ;3300 ;440 ;ParentControl=1130017 }
{ 1130019;TextBox ;13090;2640 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document Date;
SourceExpr=DocumentDate }
{ 1130020;Label ;9680 ;2640 ;3300 ;440 ;ParentControl=1130019 }
// End of the lines.
{ 1130024;TextBox ;3850 ;2640 ;2750 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Social Security Code;
SourceExpr=SocialSecurityCode;
TableRelation="Contribution Code" }
...
Replacement code 4...
InPage=0;
CaptionML=ENU=Document Type;
OptionCaptionML=ENU=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund";
OptionString=[ ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund];
SourceExpr=DocumentType }
// Add the following lines.
{ 1130016;Label ;9680 ;2090 ;3300 ;440 ;ParentControl=1130015 }
{ 1130017;TextBox ;13090;2640 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document No.;
SourceExpr=DocumentNo }
{ 1130018;Label ;9680 ;2640 ;3300 ;440 ;ParentControl=1130017 }
{ 1130019;TextBox ;13090;3190 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Document Date;
SourceExpr=DocumentDate }
{ 1130020;Label ;9680 ;3190 ;3300 ;440 ;ParentControl=1130019 }
// End of the lines.
{ 1130024;TextBox ;3850 ;2640 ;2750 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Social Security Code;
SourceExpr=SocialSecurityCode;
TableRelation="Contribution Code" }
...
Existing code 5...
InPage=0;
CaptionML=ENU=Social Security Code;
SourceExpr=SocialSecurityCode;
TableRelation="Contribution Code" }
{ 1130025;Label ;440 ;2640 ;3300 ;440 ;ParentControl=1130024 }
{ 1130021;CommandButton;14410;5720;2200;550 ;HorzGlue=Right;
VertGlue=Bottom;
PushAction=FormHelp }
{ 1130022;CommandButton;11990;5720;2200;550 ;HorzGlue=Right;
VertGlue=Bottom;
...
Replacement code 5...
InPage=0;
CaptionML=ENU=Social Security Code;
SourceExpr=SocialSecurityCode;
TableRelation="Contribution Code" }
{ 1130025;Label ;440 ;2640 ;3300 ;440 ;ParentControl=1130024 }
// Add the following lines.
{ 1130026;TextBox ;13090;1540 ;1700 ;440 ;ParentControl=1130000;
InPage=0;
CaptionML=ENU=Tax Base Amount;
SourceExpr=TaxBaseAmount }
{ 1130027;Label ;9680 ;1540 ;3300 ;440 ;ParentControl=1130026 }
// End of the lines.
{ 1130021;CommandButton;14410;5720;2200;550 ;HorzGlue=Right;
VertGlue=Bottom;
PushAction=FormHelp }
{ 1130022;CommandButton;11990;5720;2200;550 ;HorzGlue=Right;
VertGlue=Bottom;
...
Existing code 6...
"Due Date" := PostingDate;
"External Document No." := ExternalDocNo;
"Instalment Amount" := TotalAmount;
"Remaining Amount" := TotalAmount;
"Gross Amount to Pay" := TotalAmount;
// Delete the following line.
"Amount to Pay" := TotalAmount;
"Manual Line" := TRUE;
"Cumulative Transfers" := TRUE;
SetWithholdCode(WithholdingTaxCode);
SetSocialSecurityCode(SocialSecurityCode);
INSERT(TRUE)
...
Replacement code 6...
"Due Date" := PostingDate;
"External Document No." := ExternalDocNo;
"Instalment Amount" := TotalAmount;
"Remaining Amount" := TotalAmount;
"Gross Amount to Pay" := TotalAmount;
// Add the following line.
"Amount to Pay" := TaxBaseAmount;
"Manual Line" := TRUE;
"Cumulative Transfers" := TRUE;
SetWithholdCode(WithholdingTaxCode);
SetSocialSecurityCode(SocialSecurityCode);
INSERT(TRUE)
...
Change the code in the CalculateWithholdingTax function in the Withholding - Contribution codeunit (12101) as follows:
Existing code 1...
PROCEDURE CalculateWithholdingTax@1130001(VAR PurchHeader@1130000 : Record 38;Recalculate@1130001 : Boolean);
VAR
PurchWithSoc@1130002 : Record 12137;
PurchLine@1130003 : Record 39;
// Delete the following line.
TotalAmount@1130004 : Decimal;
BEGIN
PurchLine.RESET;
PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
PurchLine.SETRANGE("Document No.",PurchHeader."No.");
PurchLine.SETRANGE(Type,PurchLine.Type::"G/L Account");
...
Replacement code 1...
PROCEDURE CalculateWithholdingTax@1130001(VAR PurchHeader@1130000 : Record 38;Recalculate@1130001 : Boolean);
VAR
PurchWithSoc@1130002 : Record 12137;
PurchLine@1130003 : Record 39;
// Add the following lines.
TempPurchLine@1130005 : TEMPORARY Record 39;
TotalAmount@1130004 : Decimal;
VATAmount@1130006 : Decimal;
// End of the lines.
BEGIN
PurchLine.RESET;
PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
PurchLine.SETRANGE("Document No.",PurchHeader."No.");
PurchLine.SETRANGE(Type,PurchLine.Type::"G/L Account");
...
Existing code 2...
PurchLine.SETRANGE(Type,PurchLine.Type::"G/L Account");
TotalAmount := 0;
IF PurchLine.FIND('-') THEN
REPEAT
// Delete the following lines.
TotalAmount := TotalAmount + PurchLine."Line Amount";
UNTIL PurchLine.NEXT = 0;
// End of the lines.
IF PurchWithSoc.GET(PurchHeader."Document Type", PurchHeader."No.") THEN
IF (PurchWithSoc."Total Amount" = 0) OR
Recalculate
THEN BEGIN
PurchWithSoc."Currency Code" := PurchHeader."Currency Code";
...
Replacement code 2...
PurchLine.SETRANGE(Type,PurchLine.Type::"G/L Account");
TotalAmount := 0;
IF PurchLine.FIND('-') THEN
REPEAT
// Add the following lines.
IF PurchHeader."Prices Including VAT" THEN BEGIN
TempPurchLine := PurchLine;
TempPurchLine.VALIDATE("Amount Including VAT",PurchLine."Line Amount");
TotalAmount += TempPurchLine."VAT Base Amount"
END ELSE
TotalAmount += PurchLine."Line Amount";
UNTIL PurchLine.NEXT = 0;
// End of the lines.
IF PurchWithSoc.GET(PurchHeader."Document Type", PurchHeader."No.") THEN
IF (PurchWithSoc."Total Amount" = 0) OR
Recalculate
THEN BEGIN
PurchWithSoc."Currency Code" := PurchHeader."Currency Code";
...