AR Invoice: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 9:
{{BaseReferenceAC18}}
'''BCE.AutoCount.ARAP.dll'''
 
<br /><br />
===Create new AR Invoice===
<syntaxhighlight lang="csharp">
public void NewARInvoiceEntryEditAPInvoiceEntry(BCE.Data.DBSetting dbSetting, ARInvoiceSource source)
{
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.ARInvoiceAPInvoice.ARInvoiceDataAccessAPInvoiceDataAccess cmd = BCE.AutoCount.ARAP.ARInvoiceAPInvoice.ARInvoiceDataAccessAPInvoiceDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARInvoiceAPInvoice.ARInvoiceEntityAPInvoiceEntity doc = cmd.NewARInvoiceGetAPInvoice("PI-000001");
BCE.AutoCount.ARAP.ARInvoiceAPInvoice.ARInvoiceDTLEntityAPInvoiceDTLEntity dtl = null;
 
//if this AP Invoice has been knockoff(offset) with payment or credit note,
doc.DebtorCode = source.CustomerCode;
//Changing of CreditorCode is not allowed.
doc.Description = source.Description;
//Therefore, when such case arise, it is advised to issue Credit Note and issue a new AP Invoice
doc.CurrencyRate = source.CurrencyRate;
//doc.DocNoCreditorCode = source.Document"400-X001";
 
doc.DocDate = source.Date;
doc.SalesAgentDescription = source.SalesPerson"Purchase Generated";
doc.JournalTypeDocDate = source.JournalTypenew DateTime(2018, 5, 28);
doc.PurchaseAgent = "TOM";
//Set whether to apply rounding method of either by Document or by Each Line,
doc.JournalType = "PURCHASE";
//this may affect different result in GST Calculation due to decimal point rounding.
 
doc.RoundingMethod = source.RoundMethod;
doc.RoundingMethod = BCE.AutoCount.Document.DocumentRoundingMethod.LineByLine_Ver2;
//Document Level Inclusive Tax
doc.InclusiveTax = source.Inclusivetrue;
 
doc.ClearDetails();
foreach (ARInvoiceDetail ivDtl in source.Details)
{
dtl = doc.NewDetail();
 
//Add two lines of detail
dtl.AccNo = ivDtl.Account;
dtl.Description = ivDtldoc.DescriptionNewDetail();
dtl.ProjNoAccNo = ivDtl.Project"700-1010";
dtl.DeptNoDescription = ivDtl.Department"Raw Material Metal";
dtl.TaxTypeProjNo = ivDtlDBNull.GSTCodeValue;
dtl.Amount = ivDtl1000.Amount ?? 000M;
 
dtl.TaxAdjustment = ivDtl.GSTAdjustment;
dtl = doc.NewDetail();
}
dtl.AccNo = ivDtl.Account"700-1010";
docdtl.Description = source.Description"Process Cost";
dtl.ProjNo = DBNull.Value;
dtl.Amount = 150.00M;
 
try
{
cmd.SaveARInvoiceSaveAPInvoice(doc, userID);
//log success
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo));
Line 58 ⟶ 62:
}
</syntaxhighlight>
 
 
 
===Classes of Source===