This code snippet shows how you can apply Journal Entries when creating a Vendor Payment record via Web Services using C#.
VendorPayment vendorPayment = new VendorPayment();
VendorPaymentApply[] vendorPaymentApply = new VendorPaymentApply[1];
RecordRef account = new RecordRef();
account.type = RecordType.account;
account.typeSpecified = true;
account.internalId = "1";
RecordRef apAcct = new RecordRef();
apAcct.type = RecordType.account;
apAcct.typeSpecified = true;
apAcct.internalId = "27";
RecordRef entity = new RecordRef();
entity.type = RecordType.customer;
entity.typeSpecified = true;
entity.internalId = "17";
vendorPaymentApply[0] = new VendorPaymentApply();
vendorPaymentApply[0].apply = true;
vendorPaymentApply[0].applySpecified = true;
vendorPaymentApply[0].doc = long.Parse("4378");
vendorPaymentApply[0].docSpecified = true;
vendorPaymentApply[0].line = long.Parse("1");
vendorPaymentApply[0].lineSpecified = true;
vendorPaymentApply[0].type = "Journal";
vendorPaymentApply[0].refNum = "JRNL0014";
vendorPaymentApply[0].total = System.Double.Parse("5400");
vendorPaymentApply[0].totalSpecified = true;
vendorPaymentApply[0].due = System.Double.Parse("5400");
vendorPaymentApply[0].dueSpecified = true;
vendorPaymentApply[0].amount = System.Double.Parse("5400");
vendorPaymentApply[0].amountSpecified = true;
VendorPaymentApplyList vendorPaymentList = new VendorPaymentApplyList();
vendorPaymentList.apply = vendorPaymentApply;
vendorPayment.account = account;
vendorPayment.apAcct = apAcct;
vendorPayment.entity = entity;
vendorPayment.applyList = vendorPaymentList;
WriteResponse writeRes = _service.add(vendorPayment);
No comments:
Post a Comment