Programmer:Quotation: Difference between revisions
Content deleted Content added
No edit summary |
mNo edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Technical Specification== |
|||
⚫ | |||
===Rules in Sale Invoice=== |
|||
# NetTotal must not be negative amount |
# NetTotal must not be negative amount |
||
# Document NetTotal amount is read-only, as the net total must be the sum of detail total (sub-total). |
|||
==Assemblies version 1.8, 1.9== |
|||
{{BaseReferenceAC18}} |
|||
<pre> |
|||
BCE.AutoCount.Invoicing.dll |
'''BCE.AutoCount.Invoicing.dll''' |
||
BCE.AutoCount.Invoicing.Sales.dll |
'''BCE.AutoCount.Invoicing.Sales.dll''' |
||
</pre> |
|||
==Sample with data model== |
|||
===Create New Quotation=== |
===Create New Quotation=== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
Line 22: | Line 22: | ||
doc.CurrencyRate = source.CurrencyRate; |
doc.CurrencyRate = source.CurrencyRate; |
||
doc.Agent = source.SalesPerson; |
doc.Agent = source.SalesPerson; |
||
//Set whether to apply which rounding methodo of either Document or Each Line, |
//Set whether to apply which rounding methodo of either Document or Each Line, |
||
//this may affect different result in GST Calculation due to decimal point. |
//this may affect different result in GST Calculation due to decimal point. |
||
doc.RoundingMethod = source.RoundMethod; |
doc.RoundingMethod = source.RoundMethod; |
||
//Document Level Inclusive Tax |
//Document Level Inclusive Tax |
||
doc.InclusiveTax = source.Inclusive; |
doc.InclusiveTax = source.Inclusive; |
||
Line 111: | Line 113: | ||
CustomerCode = "300-A001", |
CustomerCode = "300-A001", |
||
Description = "SALES INVOICE GENERATED", |
Description = "SALES INVOICE GENERATED", |
||
//If let AutoCount auto assign running number, assign "<<New>>" is unnecessary |
|||
//DocumentNo = "<<New>>", |
|||
DocumentDate = new DateTime(2017, 11, 30), |
DocumentDate = new DateTime(2017, 11, 30), |
||
Inclusive = true |
Inclusive = true |
||
}; |
}; |
||
//Here shows various way to create new detail in Sale document |
|||
//There are many ways which data input can be entered into details, here are some of the common input. |
//There are many ways which data input can be entered into details, here are some of the common input. |
||
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Particulars" }); |
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Particulars" }); |
||
newDoc.Details.Add(new SaleQuotationDetail(){ ItemCode = "FG00001", Quantity = 1, UnitPrice = 50.20M, GSTCode = "SR-S" }); |
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 1, UnitPrice = 50.20M, GSTCode = "SR-S" }); |
||
newDoc.Details.Add(new SaleQuotationDetail(){ ItemCode = "FG00001", Quantity = 2, UnitPrice = 50.20M, Discount = "5%", GSTCode = "SR-S" }); |
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 2, UnitPrice = 50.20M, Discount = "5%", GSTCode = "SR-S" }); |
||
newDoc.Details.Add(new SaleQuotationDetail(){ ItemCode = "FG00001", Quantity = 1, GSTCode = "SR-S", Amount = 50.20M }); |
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 1, GSTCode = "SR-S", Amount = 50.20M }); |
||
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Non-Stock Items" }); |
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Non-Stock Items" }); |
||
//When AccNo & ItemCode both are not defined, system will retrieve from default Sale Account. |
//When AccNo & ItemCode both are not defined, system will retrieve from default Sale Account. |
||
//If default Sale Account is not maintained in Tools | Options, system will throw error on saving. |
//If default Sale Account is not maintained in Tools | Options, system will throw error on saving. |
||
newDoc.Details.Add(new SaleQuotationDetail(){ Description = "Misc. Charges", GSTCode = "SR-S", Amount = 30 }); |
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Misc. Charges", GSTCode = "SR-S", Amount = 30 }); |
||
newDoc.Details.Add(new SaleQuotationDetail(){ Account = "500-0000", Description = "Transport", Amount = 50, GSTCode = "SR-S" }); |
newDoc.Details.Add(new SaleQuotationDetail() { Account = "500-0000", Description = "Transport", Amount = 50, GSTCode = "SR-S" }); |
||
NewSaleQuotation(dbSetting, newDoc); |
NewSaleQuotation(dbSetting, newDoc); |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{Note|'''Non-Stock Item''' can either with or without ItemCode, it depends on the setting & preference of customer Account Book.}} |
|||
{{SeeAlsoSale}} |
|||
==See Also== |
|||
⚫ | |||
* [[Programmer:Quotation]] |
|||
* [[Programmer:Sales Order]] |
|||
* [[Programmer:Delivery Order]] |
|||
* [[Programmer:Sales Invoice]] |
|||
* [[Programmer:Cash Sale]] |
|||
[[Category:Programmer]] |
|||
[[Category:API]] |
|||
[[Category:Integrate]] |
|||
[[Category:Plug-In]] |
Latest revision as of 03:19, 5 June 2018
Technical Specification
- NetTotal must not be negative amount
- Document NetTotal amount is read-only, as the net total must be the sum of detail total (sub-total).
Assemblies version 1.8, 1.9
BCE.AutoCount.dll BCE.AutoCount.CommonAccounting.dll BCE.AutoCount.MainEntry.dll BCE.Utils.dll BCE.Utils.UI.dll BCE.AutoCount.Invoicing.dll BCE.AutoCount.Invoicing.Sales.dll
Sample with data model
Create New Quotation
public void NewSaleQuotation(BCE.Data.DBSetting dbSetting, SaleQuotationSource source)
{
BCE.AutoCount.Invoicing.Sales.Quotation.QuotationCommand cmd = BCE.AutoCount.Invoicing.Sales.Quotation.QuotationCommand.Create(dbSetting);
BCE.AutoCount.Invoicing.Sales.Quotation.Quotation doc = cmd.AddNew();
doc.DebtorCode = source.CustomerCode;
doc.DocNo = source.DocumentNo;
doc.DocDate = source.DocumentDate;
doc.Description = source.Description;
doc.CurrencyRate = source.CurrencyRate;
doc.Agent = source.SalesPerson;
//Set whether to apply which rounding methodo of either Document or Each Line,
//this may affect different result in GST Calculation due to decimal point.
doc.RoundingMethod = source.RoundMethod;
//Document Level Inclusive Tax
doc.InclusiveTax = source.Inclusive;
source.Details.ForEach(s => AddSaleQuotationDetail(s, doc.AddDetail));
try
{
doc.Save();
//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);
}
}
private void AddSaleQuotationDetail(SaleQuotationDetail sourceDtl,
Func<BCE.AutoCount.Invoicing.Sales.Quotation.QuotationDetail> addDtlToDoc)
{
BCE.AutoCount.Invoicing.Sales.Quotation.QuotationDetail dtl = addDtlToDoc();
//Quotation has no AccNo
dtl.ItemCode = sourceDtl.ItemCode;
dtl.Description = sourceDtl.Description ?? dtl.Description;
if (sourceDtl.Project != null)
dtl.ProjNo = sourceDtl.Project;
if (sourceDtl.Department != null)
dtl.DeptNo = sourceDtl.Department;
if (sourceDtl.Location != null)
dtl.Location = sourceDtl.Location;
dtl.Qty = sourceDtl.Quantity ?? dtl.Qty;
dtl.UOM = sourceDtl.Uom ?? dtl.UOM;
dtl.UnitPrice = sourceDtl.UnitPrice ?? dtl.UnitPrice;
dtl.Discount = sourceDtl.Discount ?? dtl.Discount;
dtl.SubTotal = sourceDtl.Amount ?? dtl.SubTotal;
if (sourceDtl.GSTCode != null)
dtl.TaxType = sourceDtl.GSTCode;
dtl.TaxAdjustment = sourceDtl.GSTAdjustment;
}
Classes of source
public class SaleQuotationSource
{
public string CustomerCode { get; set; }
public string DocumentNo { get; set; }
public DateTime DocumentDate { get; set; }
public string Description { get; set; }
public decimal CurrencyRate { get; set; } = 1;
public string SalesPerson { get; set; }
public BCE.AutoCount.Document.DocumentRoundingMethod RoundMethod { get; set; } =
BCE.AutoCount.Document.DocumentRoundingMethod.LineByLine_Ver2;
public bool Inclusive { get; set; } = false;
public List<SaleQuotationDetail> Details { get; set; } = new List<SaleQuotationDetail>();
}
public class SaleQuotationDetail
{
public string Account { get; set; }
public string ItemCode { get; set; }
public string Description { get; set; }
public string Location { get; set; }
public string Project { get; set; }
public string Department { get; set; }
public decimal? Quantity { get; set; }
public string Uom { get; set; }
public decimal? UnitPrice { get; set; }
public string Discount { 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)
{
SaleQuotationSource newDoc = new SaleQuotationSource()
{
CustomerCode = "300-A001",
Description = "SALES INVOICE GENERATED",
//If let AutoCount auto assign running number, assign "<<New>>" is unnecessary
//DocumentNo = "<<New>>",
DocumentDate = new DateTime(2017, 11, 30),
Inclusive = true
};
//Here shows various way to create new detail in Sale document
//There are many ways which data input can be entered into details, here are some of the common input.
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Particulars" });
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 1, UnitPrice = 50.20M, GSTCode = "SR-S" });
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 2, UnitPrice = 50.20M, Discount = "5%", GSTCode = "SR-S" });
newDoc.Details.Add(new SaleQuotationDetail() { ItemCode = "FG00001", Quantity = 1, GSTCode = "SR-S", Amount = 50.20M });
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Non-Stock Items" });
//When AccNo & ItemCode both are not defined, system will retrieve from default Sale Account.
//If default Sale Account is not maintained in Tools | Options, system will throw error on saving.
newDoc.Details.Add(new SaleQuotationDetail() { Description = "Misc. Charges", GSTCode = "SR-S", Amount = 30 });
newDoc.Details.Add(new SaleQuotationDetail() { Account = "500-0000", Description = "Transport", Amount = 50, GSTCode = "SR-S" });
NewSaleQuotation(dbSetting, newDoc);
}
![]() |
Non-Stock Item can either with or without ItemCode, it depends on the setting & preference of customer Account Book. |
See Also
- Programmer:Quotation
- Programmer:Sales Order
- Programmer:Delivery Order
- Programmer:Sales Invoice
- Programmer:Cash Sale with Payment
![]() |
Go to top
|
![]() |
Resources For AutoCount Software Developers
|