AR Deposit v2: Difference between revisions
Content added Content deleted
(Created page with "===Rules in AR Deposit=== # DepositPaymentMethod must be a payment method that is link to an Account that is created as type of "Deposit" Account. ===Assemblies version 1.8==...") |
No edit summary |
||
Line 2: | Line 2: | ||
# DepositPaymentMethod must be a payment method that is link to an Account that is created as type of "Deposit" Account. |
# DepositPaymentMethod must be a payment method that is link to an Account that is created as type of "Deposit" Account. |
||
===Assemblies version |
===Assemblies version 2.0=== |
||
{{BaseReferenceAC20}} |
|||
{{BaseReferenceAC18}} |
|||
''' |
'''AutoCount.ARAP.dll''' |
||
<br /><br /> |
<br /><br /> |
||
===Create new AR Deposit=== |
===Create new AR Deposit=== |
||
Line 93: | Line 93: | ||
new AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder(); |
new AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder(); |
||
//The return table contains of 3 columns: (1) PaymentMethod, (2) BankAccount, (3) CurrencyCode |
//The return table contains of 3 columns: (1) PaymentMethod, (2) BankAccount, (3) CurrencyCode |
||
return depositBuilder.BuildDataTable(userSession); |
return depositBuilder.BuildDataTable(userSession); |
||
} |
} |
Revision as of 10:12, 18 May 2018
Rules in AR Deposit
- DepositPaymentMethod must be a payment method that is link to an Account that is created as type of "Deposit" Account.
Assemblies version 2.0
AutoCount.Accounting.dll AutoCount.Accounting.UI.dll AutoCount.dll AutoCount.MainEntry.dll AutoCount.UI.dll AutoCount.ARAP.dll
Create new AR Deposit
public void NewARDeposit(ARDepositSource source, AutoCount.Authentication.UserSession userSession)
{
AutoCount.ARAP.ARDeposit.ARDepositCommand cmd =
AutoCount.ARAP.ARDeposit.ARDepositCommand.Create(userSession, userSession.DBSetting);
AutoCount.ARAP.ARDeposit.ARDeposit doc = cmd.AddNew();
if (IsValidDepositMethod(source.DepositMethod, userSession))
{
doc.DepositPaymentMethod = source.DepositMethod;
}
else
{
AutoCount.AppMessage.ShowErrorMessage(string.Format("Invalid Deposit Payment Method of \"{0}\"", source.DepositMethod));
//log error on Deposit Payment Method error
return;
}
doc.DocNo = source.DocumentNo ?? doc.DocNo;
doc.DocDate = source.DocumentDate;
doc.Description = source.Description ?? doc.Description;
doc.CurrencyCode = source.CurrencyCode ?? doc.CurrencyCode;
doc.DebtorCode = source.CustomerAccount;
doc.DebtorName = source.CustomerName;
doc.Attention = source.Attention;
doc.Phone1 = source.Phone;
doc.Fax1 = source.Fax;
doc.ProjNo = source.Project;
doc.DeptNo = source.Department;
source.PaymentDetail.ForEach(s => AddARDepositDetail(s, doc.AddDetail));
try
{
doc.Save();
AutoCount.AppMessage.ShowMessage(string.Format("{0} is Created.", doc.DocNo));
//Log Success created
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowErrorMessage(ex.Message);
//Log Error saving
}
}
public void AddARDepositDetail(ARDepositDetailSource source, Func<AutoCount.ARAP.ARDeposit.ARDepositDetail> addDepositDetail)
{
AutoCount.ARAP.ARDeposit.ARDepositDetail dtl = addDepositDetail();
dtl.PaymentMethod = source.PaymentMethod;
dtl.ChequeNo = source.ChequeNo;
dtl.PaymentAmt = source.DepositAmount;
dtl.BankCharge = source.BankCharge;
dtl.BankChargeTaxType = source.BankChargeTaxCode;
dtl.BankChargeTaxRefNo = source.BankChargeBillNoForGst;
dtl.PaymentBy = source.PaymentBy;
//Returned Cheque
if (source.ReturnChequeDate.HasValue)
{
dtl.IsRCHQ = true;
dtl.RCHQDate = source.ReturnChequeDate.Value;
}
else
{
dtl.IsRCHQ = false;
}
}
Method to check the validity of (Deposit) Payment Method
private bool IsValidDepositMethod(string depositMethod, AutoCount.Authentication.UserSession userSession)
{
return GetDepositPaymentMethod(userSession).AsEnumerable()
.Count(r => r.Field<string>("PaymentMethod") == depositMethod) > 0;
}
Get Deposit Payment Method Table with AutoCount Lookup Edit Builder
private DataTable GetDepositPaymentMethod(AutoCount.Authentication.UserSession userSession)
{
AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder depositBuilder =
new AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder();
//The return table contains of 3 columns: (1) PaymentMethod, (2) BankAccount, (3) CurrencyCode
return depositBuilder.BuildDataTable(userSession);
}
Classes of Source
public class ARDepositSource
{
public string DocumentNo { get; set; }
public DateTime DocumentDate { get; set; } = DateTime.Today.Date;
public string Description { get; set; }
public string DepositMethod { get; set; }
//Currency Code that is used to pay the deposit
public string CurrencyCode { get; set; }
public string CustomerAccount { get; set; }
public string CustomerName { get; set; }
public string Attention { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string Project { get; set; }
public string Department { get; set; }
//IsSecurityDeposit is to decide whether this deposit is subject to GST
//true: not subject to GST and is meant to be refund
//false: subject to GST and is considered as "Advance Payment"
public bool IsSecurityDeposit { get; set; }
public List<ARDepositDetailSource> PaymentDetail = new List<ARDepositDetailSource>();
}
public class ARDepositDetailSource
{
public string PaymentMethod { get; set; }
public string ChequeNo { get; set; }
public decimal DepositAmount { get; set; }
public decimal BankCharge { get; set; }
public string BankChargeTaxCode { get; set; }
public string BankChargeBillNoForGst { get; set; }
public string PaymentBy { get; set; }
//If this cheque is returned/bounced cheque
//Set the returned/bounced date. Otherwise it is null
public DateTime? ReturnChequeDate { get; set; }
}
See Also
- AR Debtor v2
- AR Invoice v2
- AR Received Payment v2
- AR Debit Note v2
- AR Credit Note v2
- AR Refund v2
- AR Deposit v2
- AR Deposit - Create New or Update with Refund & Forfeit v2
Go to top
|
Resources For AutoCount Software Developers
|