AR Invoice: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
{{BaseReferenceAC18}} |
{{BaseReferenceAC18}} |
||
'''BCE.AutoCount.ARAP.dll''' |
'''BCE.AutoCount.ARAP.dll''' |
||
<br /><br /> |
<br /><br /> |
||
===Create new AR Invoice=== |
===Create new AR Invoice=== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public void |
public void EditAPInvoiceEntry(BCE.Data.DBSetting dbSetting) |
||
{ |
{ |
||
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
||
BCE.AutoCount.ARAP. |
BCE.AutoCount.ARAP.APInvoice.APInvoiceDataAccess cmd = BCE.AutoCount.ARAP.APInvoice.APInvoiceDataAccess.Create(dbSetting); |
||
BCE.AutoCount.ARAP. |
BCE.AutoCount.ARAP.APInvoice.APInvoiceEntity doc = cmd.GetAPInvoice("PI-000001"); |
||
BCE.AutoCount.ARAP. |
BCE.AutoCount.ARAP.APInvoice.APInvoiceDTLEntity 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. |
|||
⚫ | |||
//Therefore, when such case arise, it is advised to issue Credit Note and issue a new AP Invoice |
|||
doc.CurrencyRate = source.CurrencyRate; |
|||
doc. |
//doc.CreditorCode = "400-X001"; |
||
doc.DocDate = source.Date; |
|||
doc. |
doc.Description = "Purchase Generated"; |
||
doc. |
doc.DocDate = new 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 |
//Document Level Inclusive Tax |
||
doc.InclusiveTax = |
doc.InclusiveTax = true; |
||
doc.ClearDetails(); |
|||
foreach (ARInvoiceDetail ivDtl in source.Details) |
|||
{ |
|||
⚫ | |||
//Add two lines of detail |
|||
⚫ | |||
dtl = doc.NewDetail(); |
|||
dtl.AccNo = "700-1010"; |
|||
dtl.Description = "Raw Material Metal"; |
|||
dtl.ProjNo = DBNull.Value; |
|||
dtl.Amount = 1000.00M; |
|||
dtl.TaxAdjustment = ivDtl.GSTAdjustment; |
|||
⚫ | |||
} |
|||
⚫ | |||
⚫ | |||
dtl.ProjNo = DBNull.Value; |
|||
dtl.Amount = 150.00M; |
|||
try |
try |
||
{ |
{ |
||
cmd. |
cmd.SaveAPInvoice(doc, userID); |
||
//log success |
//log success |
||
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo)); |
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo)); |
||
Line 58: | Line 62: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
===Classes of Source=== |
===Classes of Source=== |
Revision as of 09:02, 28 May 2018
Rules in ARInvoice
- AccNo (Sales A/C) cannot be empty or null.
- AccNo (Purchase A/C) cannot be Creditor 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.
References of AutoCount Accounting version 1.8
BCE.AutoCount.dll BCE.AutoCount.CommonAccounting.dll BCE.AutoCount.MainEntry.dll BCE.Utils.dll BCE.Utils.UI.dll BCE.AutoCount.ARAP.dll
Create new AR Invoice
public void EditAPInvoiceEntry(BCE.Data.DBSetting dbSetting)
{
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.APInvoice.APInvoiceDataAccess cmd = BCE.AutoCount.ARAP.APInvoice.APInvoiceDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.APInvoice.APInvoiceEntity doc = cmd.GetAPInvoice("PI-000001");
BCE.AutoCount.ARAP.APInvoice.APInvoiceDTLEntity dtl = null;
//if this AP Invoice has been knockoff(offset) with payment or credit note,
//Changing of CreditorCode is not allowed.
//Therefore, when such case arise, it is advised to issue Credit Note and issue a new AP Invoice
//doc.CreditorCode = "400-X001";
doc.Description = "Purchase Generated";
doc.DocDate = new DateTime(2018, 5, 28);
doc.PurchaseAgent = "TOM";
doc.JournalType = "PURCHASE";
doc.RoundingMethod = BCE.AutoCount.Document.DocumentRoundingMethod.LineByLine_Ver2;
//Document Level Inclusive Tax
doc.InclusiveTax = true;
doc.ClearDetails();
//Add two lines of detail
dtl = doc.NewDetail();
dtl.AccNo = "700-1010";
dtl.Description = "Raw Material Metal";
dtl.ProjNo = DBNull.Value;
dtl.Amount = 1000.00M;
dtl = doc.NewDetail();
dtl.AccNo = "700-1010";
dtl.Description = "Process Cost";
dtl.ProjNo = DBNull.Value;
dtl.Amount = 150.00M;
try
{
cmd.SaveAPInvoice(doc, userID);
//log success
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo));
}
catch (BCE.Application.AppException ex)
{
//log ex.Message
//BCE.Application.AppMessage.ShowMessage(ex.Message);
}
}
Classes of Source
public class ARInvoiceSource
{
public string CustomerCode { get; set; }
public string Description { get; set; }
public decimal CurrencyRate { get; set; } = 1;
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; }
}
Implementation
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);
}
Go to top
|
Resources For AutoCount Software Developers
|