- When the user clicks "Invoice Verification" from the Purch Order Form, place the follwing in the PurchEditLines Form
- Invoice Balance
- SalesTax
- Line Discount
- Balance
When you clicked the Totals button the PurchParmTableTotals Form gets activated and the PurchTotals class gets instantiated. So I needed to basically replicate what this form is doing to present the values we see above in the PurchEditLines form as show below.
In the PurchParamTable (Data Source) of the PurchEditLines form I added a call to my method:
int active()
{
PurchTable localPurchTable;
int ok;
;
ok = super();
localPurchTable = purchParmTable.purchTable();
purchEditLinesForm.setPurchTable(localPurchTable);
buttonPaymentSched.enabled(localPurchTable.PaymentSched != '');
buttonErrorLog.enabled(purchParmTable.Log != '');
subTableSetupButton.enabled((select count(RecId) from purchParmSubTable where purchParmSubTable.ParmId == purchParmTable.ParmId && purchParmSubTable.TableRefId == purchParmTable.TableRefId).RecId > 1);
purchParmTable_FixedDueDate.allowEdit( purchEditLinesForm.fixedDueDateAllowEdit() && localPurchTable.PaymentSched == '');
purchParmTable_FixedDueDate.skip (!(purchEditLinesForm.fixedDueDateAllowEdit() && localPurchTable.PaymentSched == ''));
this.enableFixedExchRate();
purchParmTable_ds.object(fieldnum(PurchParmTable, VendInvoiceSaveStatus)).allowEdit( purchParmTable.VendInvoiceSaveStatus != VendInvoiceSaveStatus::Pending );
purchParmTable_ds.object(fieldnum(PurchParmTable, VendInvoiceSaveStatus)).skip( purchParmTable.VendInvoiceSaveStatus == VendInvoiceSaveStatus::Pending );
// enable if valid record in the grid
element.enableParmTablePackingSlipsButton(this.canMatchPackingSlips());
element.enableMatchingDetailsButtons();
//Call Custom Method
element.calcPurchParmTotals();
return ok;
}
Below is the calcPurchParmTotals() custom method:
void calcPurchParmTotals()
{
Object purchEditLines;
;
purchEditLines = element.args().caller();
if(purchParmTable.ParmId)
{
purchTotals = PurchTotals::newPurchParmTable(purchParmTable, purchEditLines.specQty(), AccountOrder::None, purchParmTable.ParmId,
'', purchParmTable.Ordering);
purchTotals.calc();
element.setDisplayFields();
}
}
Then I call the setDisplayFields() custom method to get the calculated data from a container:
void setDisplayFields()//Earias - 2/3/2011
{
container displayFields = purchTotals.displayFields([PurchTotals::posCashDisc(),
PurchTotals::posCashDiscDate(),
PurchTotals::posEndDisc(),
PurchTotals::posTaxRoundOff(),
PurchTotals::posRoundOff(),
PurchTotals::posCurrency(),
PurchTotals::posExchRate(),
PurchTotals::posLineDisc(),
PurchTotals::posBalance(),
PurchTotals::posMarkup(),
PurchTotals::posTaxTotal(),
PurchTotals::posTotalAmount(),
PurchTotals::posRoundOff()]);
;
LineDiscount.realValue (conpeek(displayFields, PurchTotals::posLineDisc()));
Balance.realValue (conpeek(displayFields, PurchTotals::posBalance()));
SalesTax.realValue (conpeek(displayFields, PurchTotals::posTaxTotal()));
InvoiceAmount.realValue (conpeek(displayFields, PurchTotals::posTotalAmount()));
purchParmTable.dataSource().reread();
purchParmTable.dataSource().refresh();
}
At this point you will see the following:
No comments:
Post a Comment
Thank you for your thoughts. Your comment will appear in my blog shortly after review.
Have a great day!