AR Invoice: Difference between revisions

4,277 bytes added ,  5 years ago
m
no edit summary
No edit summary
mNo edit summary
 
(22 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
{{NavigateDeveloper}}
# AccNo (Sales A/C) cannot be empty or null.
===Rules in ARInvoice===
# AccNo (Sales A/C) must notcannot be emptyDebtor or nullCreditor Account No.
# NetTotal cannot be in negative value.
# '''NetTotal''' is the sum of amount & GST from details, this field is '''ReadOnly'''.
# Total '''GST''' is the sum of GST & GST Adjustment from details, this field is '''ReadOnly'''.
# Do not set '''empty string''' to '''ProjNo''' and '''DeptNo''', when it is empty, set to '''DBNull.Value'''.
 
<br />
===Assemblies version 1.8===
==References of AutoCount Accounting version 1.8, 1.9==
<pre>
{{BaseReferenceAC18}}
BCE.AutoCount.ARAP.dll
'''BCE.AutoCount.ARAP.dll'''
</pre>
 
<br />
==Sample with data model==
===Create new AR Invoice===
<syntaxhighlight lang="csharp">
public void NewARInvoiceEntry(BCE.Data.DBSetting dbSetting, ARInvoiceSource source)
{
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess cmd =
BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(dbSetting);
 
BCE.AutoCount.ARAP.ARInvoice.ARInvoiceEntity doc = cmd.NewARInvoice();
BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDTLEntity dtl = null;
 
doc.DebtorCode = source.CustomerCode;
doc.Description = source.Description;
doc.CurrencyRate = source.CurrencyRate;
doc.DocNo = source.Document;
doc.DocDate = source.Date;
doc.SalesAgent = source.SalesPerson;
doc.JournalType = source.JournalType;
 
//Set whether to apply rounding method of either by Document or by Each Line,
//this may affect different result in GST Calculation due to decimal point rounding.
doc.RoundingMethod = source.RoundMethod;
 
//Document Level Inclusive Tax
doc.InclusiveTax = source.Inclusive;
 
foreach (ARInvoiceDetail ivDtl in source.Details)
{
dtl = doc.NewDetail();
 
dtl.AccNo = ivDtl.Account;
dtl.Description = ivDtl.Description;
dtl.ProjNo = ivDtl.Project;
dtl.DeptNo = ivDtl.Department;
dtl.TaxType = ivDtl.GSTCode;
dtl.Amount = ivDtl.Amount ?? 0;
dtl.TaxAdjustment = ivDtl.GSTAdjustment;
}
 
try
{
cmd.SaveARInvoice(doc, userID);
//log success
//AutoCount.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo));
}
catch (BCE.Application.AppException ex)
{
//log ex.Message
//AutoCount.AppMessage.ShowMessage(ex.Message);
}
}
</syntaxhighlight>
 
==See=Classes Alsoof Source===
<syntaxhighlight lang="csharp">
* [[AR Debtor]]
public class ARInvoiceSource
* [[AR Invoice]]
{
* [[AR Received Payment]]
public string CustomerCode { get; set; }
* [[AR Debit Note]]
public string Description { get; set; }
* [[AR Credit Note]]
public decimal CurrencyRate { get; set; } = 1;
* [[AR Refund]]
public string Document { get; set; }
public DateTime Date { get; set; }
public string SalesPerson { get; set; }
public string JournalType { get; set; } = "SALES";
public BCE.AutoCount.Document.DocumentRoundingMethod RoundMethod { get; set; } =
BCE.AutoCount.Document.DocumentRoundingMethod.LineByLine_Ver2;
public bool Inclusive { get; set; } = false;
public List<ARInvoiceDetail> Details { get; set; } = new List<ARInvoiceDetail>();
}
 
public class ARInvoiceDetail
{
public string Account { get; set; }
public string Description { get; set; }
public string Project { get; set; }
public string Department { get; set; }
public decimal? Amount { get; set; }
public string GSTCode { get; set; }
public decimal GSTAdjustment { get; set; }
}
</syntaxhighlight>
 
===Implementation===
[[File:GenerateSaleInAR.PNG|link=]]
<syntaxhighlight lang="csharp" highlight="16,17">
public void MainEntry(BCE.Data.DBSetting dbSetting)
{
ARInvoiceSource newDoc = new ARInvoiceSource()
{
CustomerCode = "300-A001",
Description = "SALES GENERATED",
Document = "<<New>>",
Date = new DateTime(2017, 11, 27),
Inclusive = true
};
 
newDoc.Details.Add(new ARInvoiceDetail(){ Account = "500-0000", Description = "APPLE IPHONE X", Amount = 5000, GSTCode = "SR-S" });
newDoc.Details.Add(new ARInvoiceDetail(){ Account = "520-0000", Description = "Discount 10%", Amount = -500, GSTCode = "SR-S" });
//No error while the Account is empty, because the amount is zero;
//Hence no posting to account is required.
newDoc.Details.Add(new ARInvoiceDetail(){ Description = "GIFT", Amount = 0, GSTCode = "SR-S" });
newDoc.Details.Add(new ARInvoiceDetail(){ Account = "500-0000", Description = "FREE Screen Protector", GSTCode = "SR-S" });
 
NewARInvoiceEntry(dbSetting, newDoc);
}
</syntaxhighlight>
 
{{SeeAlsoAPIAccount}}
[[Category:Programmer]]
[[Category:API]]
[[Category:Integrate]]
[[Category:Plug-In]]
{{NavigateDeveloper}}