Programmer:Cash Sale with Payment: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 93: | Line 93: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
<br/> |
|||
==New Cash Sale with Cash Sale Payment== |
|||
<tabber> |
|||
CASH= |
|||
<syntaxhighlight lang="c#"> |
|||
public void NewCashSaleWithCash(BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
BCE.AutoCount.Invoicing.Sales.CashSale.CashSaleCommand cmd = |
|||
BCE.AutoCount.Invoicing.Sales.CashSale.CashSaleCommand.Create(dbSetting); |
|||
BCE.AutoCount.Invoicing.Sales.CashSale.CashSale doc = cmd.AddNew(); |
|||
BCE.AutoCount.Invoicing.Sales.CashSale.CashSaleDetail dtl; |
|||
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity paymentDtl; |
|||
//doc.DocNo = "CS-00011"; |
|||
doc.DebtorCode = "300-C001"; |
|||
doc.DocDate = DateTime.Today.Date; |
|||
//Enable 5 cents rounding in this document |
|||
//Ensure the "5 Cents Rounding Adjustment Account" is set to an account, |
|||
//in Tools | Options > G/L | G/L Posting... |
|||
doc.IsRoundAdj = true; |
|||
dtl = doc.AddDetail(); |
|||
dtl.ItemCode = "FG00001"; |
|||
dtl.Qty = 1; |
|||
dtl.UOM = "UNIT"; |
|||
dtl.UnitPrice = 50.20M; |
|||
dtl.TaxType = "S-10"; |
|||
dtl = doc.AddDetail(); |
|||
dtl.ItemCode = "FG00002"; |
|||
dtl.Qty = 10; |
|||
dtl.UOM = "UNIT"; |
|||
dtl.UnitPrice = 60.20M; |
|||
dtl.Discount = "30%"; |
|||
dtl.TaxType = "S-10"; |
|||
//Create new Cash Sale Payment |
|||
doc.CashSalePayment = BCE.AutoCount.Invoicing.Sales.SalesPayment.Create(doc.ReferPaymentDocKey, doc.DocKey, "CS", dbSetting); |
|||
//PaymentMode 1 indicate the payment is by Cash |
|||
doc.PaymentMode = 1; |
|||
doc.CashPayment = doc.FinalTotal; |
|||
doc.CCApprovalCode = DBNull.Value; |
|||
doc.CashSalePayment.ARPayment.ToHomeRate = doc.CurrencyRate; |
|||
//Payment |
|||
doc.CashSalePayment.ARPayment.ClearDetails(); |
|||
paymentDtl = doc.CashSalePayment.ARPayment.NewDetail(); |
|||
//Assgin "CASH" to paymentmethod that has been maintained |
|||
//in General Maintenance | Payment Method Maintenance |
|||
paymentDtl.PaymentMethod = "CASH"; |
|||
try |
|||
{ |
|||
doc.Save(); |
|||
BCE.Application.AppMessage.ShowMessage($"{doc.DocNo} is created."); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
BCE.Application.AppMessage.ShowErrorMessage($"Failed to save Cash Sale.\n{ex.Message}"); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
</tabber> |
|||
==Edit Cash Sale that has payment== |
|||
<syntaxhighlight lang="c#"> |
|||
</syntaxhighlight> |
|||
<br/> |
|||
{{SeeAlsoSale}} |
{{SeeAlsoSale}} |
||
{{NavigateDeveloper}} |
{{NavigateDeveloper}} |