AP Invoice: Difference between revisions

1,247 bytes added ,  5 years ago
no edit summary
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
==Under Construction==
 
 
===Rules in APInvoice===
# AccNo (Purchase A/C) cannot be empty or null.
# AccNo (Purchase A/C) cannot be Creditor Account No.
Line 8 ⟶ 5:
# '''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'''.
 
===References of AutoCount Accounting version 1.8=, 1.9==
{{BaseReferenceAC18}}
'''BCE.AutoCount.ARAP.dll'''
Line 24 ⟶ 22:
BCE.AutoCount.ARAP.APInvoice.APInvoiceDTLEntity dtl = null;
 
doc.DocNo = "<<New>>";
doc.CreditorCode = "400-X001";
doc.DocDate = new DateTime(2018, 5, 28);
doc.Description = "Purchase Generated";
doc.DocNo = "<<New>>";
doc.DocDate = new DateTime(2018, 5, 28);
doc.PurchaseAgent = "TOM";
doc.JournalType = "PURCHASE";
Line 78 ⟶ 76:
//doc.CreditorCode = "400-X001";
 
doc.Description = "Purchase Generated";
doc.DocDate = new DateTime(2018, 5, 28);
doc.Description = "Purchase Generated";
doc.PurchaseAgent = "TOM";
doc.JournalType = "PURCHASE";
Line 155 ⟶ 153:
 
==Sample==
===Create new AP Invoice from DataModel===
<syntaxhighlight lang="csharp">
public void DeleteAPInvoiceNewAPInvoiceEntry(BCE.Data.DBSetting dbSetting, APInvoiceSource source)
{
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.NewAPInvoice();
BCE.AutoCount.ARAP.APInvoice.APInvoiceDTLEntity dtl = null;
 
doc.CreditorCode = source.SupplierCode;
doc.DocNo = source.Document;
doc.DocDate = source.Date;
doc.CurrencyRate = source.CurrencyRate;
 
doc.Description = source.Description;
doc.PurchaseAgent = source.PurchaseAgent;
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 (APInvoiceDetail 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.DeleteAPInvoiceSaveAPInvoice("PI-000001"doc, userID);
//log success
//AutoCount.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo));
}
catch (BCE.Application.AppException ex)
{
BCE.Application.AppMessage.ShowMessage(//log ex.Message);
//AutoCount.AppMessage.ShowMessage(ex.Message);
}
}
</syntaxhighlight>
 
===Classes of Source (DataModel)===
<syntaxhighlight lang="csharp">
public class APInvoiceSource
Line 213 ⟶ 244:
Document = "<<New>>",
Date = new DateTime(2018, 5, 28),
PurchaseAgent = "TOM",
JournalType = "PURCHASE",
RoundMethod = BCE.AutoCount.Document.DocumentRoundingMethod.LineByLine_Ver2,
Inclusive = true
};
Line 226 ⟶ 257:
</syntaxhighlight>
 
{{SeeAlsoAPIAccount}}
{{SeeAlsoAccount}}
 
[[Category:Programmer]]
[[Category:API]]