public void LoadReport(BLL.Payment data) { try { List <BLL.Payment> PList = new List <BLL.Payment>(); List <BLL.FundMaster> CList = new List <BLL.FundMaster>(); PList.Add(data); CList.Add(BLL.UserAccount.User.UserType.Fund); rptQuickPayment.Reset(); ReportDataSource data1 = new ReportDataSource("Payment", PList); ReportDataSource data2 = new ReportDataSource("FundMaster", CList); ReportDataSource data3 = new ReportDataSource("PDetails", data.PDetails); rptQuickPayment.LocalReport.DataSources.Add(data1); rptQuickPayment.LocalReport.DataSources.Add(data2); rptQuickPayment.LocalReport.DataSources.Add(data3); rptQuickPayment.LocalReport.ReportPath = @"Transaction\rptPaymentVoucher.rdlc"; ReportParameter[] par = new ReportParameter[2]; par[0] = new ReportParameter("AmountInWords", data.AmountInwords); par[1] = new ReportParameter("Fund", BLL.UserAccount.User.UserType.Fund.FundName); rptQuickPayment.LocalReport.SetParameters(par); rptQuickPayment.RefreshReport(); } catch (Exception ex) { } }
private void btnSave_Click(object sender, RoutedEventArgs e) { var l1 = dgvBankReconciliation.ItemsSource; if (l1 != null) { foreach (var d in l1) { var b = d as BLL.BankReconcilation; if (b != null) { if (b.EType == 'P') { BLL.Payment p = new BLL.Payment(); p.SearchText = b.EntryNo; p.Find(); p.Status = b.IsCompleted ? "Completed" : "Proccess"; p.Save(); } else if (b.EType == 'R') { BLL.Receipt R = new BLL.Receipt(); R.SearchText = b.EntryNo; R.Find(); R.Status = b.IsCompleted ? "Completed" : "Proccess"; R.Save(); } } } MessageBox.Show(Message.PL.Saved_Alert); App.frmHome.ShowWelcome(); } }
public void LoadReport(BLL.Payment data, string Payto, string ChequeNo, string AmtInWords) { try { List <BLL.Payment> POList = new List <BLL.Payment>(); List <BLL.CompanyDetail> CList = new List <BLL.CompanyDetail>(); POList.Add(data); CList.Add(BLL.UserAccount.Company); rptQuickPayment.Reset(); ReportDataSource data1 = new ReportDataSource("Payment", POList); ReportDataSource data2 = new ReportDataSource("CompanyDetail", CList); rptQuickPayment.LocalReport.DataSources.Add(data1); rptQuickPayment.LocalReport.DataSources.Add(data2); rptQuickPayment.LocalReport.ReportPath = @"rpt\Transaction\rptPaymentvoucher.rdlc"; ReportParameter[] par = new ReportParameter[3]; par[0] = new ReportParameter("PayTo", Payto.ToUpper()); par[1] = new ReportParameter("ChequeNo", ChequeNo); par[2] = new ReportParameter("AmtInwords", AmtInWords.ToUpper()); rptQuickPayment.LocalReport.SetParameters(par); rptQuickPayment.RefreshReport(); } catch (Exception ex) { } }
public bool Payment_Save(BLL.Payment PO) { try { DAL.Payment d = DB.Payments.Where(x => x.Id == PO.Id).FirstOrDefault(); if (d == null) { d = new DAL.Payment(); DB.Payments.Add(d); PO.toCopy <DAL.Payment>(d); foreach (var b_pod in PO.PDetails) { DAL.PaymentDetail d_pod = new DAL.PaymentDetail(); b_pod.toCopy <DAL.PaymentDetail>(d_pod); d.PaymentDetails.Add(d_pod); } DB.SaveChanges(); PO.Id = d.Id; LogDetailStore(PO, LogDetailType.INSERT); } else { //foreach (var d_pod in d.PaymentDetails.ToList()) //{ // BLL.PaymentDetail b_pod = PO.PDetails.Where(x => x.Id == d_pod.Id).FirstOrDefault(); // if (b_pod == null) d.PaymentDetails.Remove(d_pod); //} decimal pdId = PO.PDetails.Select(x => x.PaymentId).FirstOrDefault(); DB.PaymentDetails.RemoveRange(d.PaymentDetails.Where(x => x.PaymentId == pdId).ToList()); PO.toCopy <DAL.Payment>(d); foreach (var b_pod in PO.PDetails) { DAL.PaymentDetail d_pod = d.PaymentDetails.Where(x => x.Id == b_pod.Id).FirstOrDefault(); if (d_pod == null) { d_pod = new DAL.PaymentDetail(); d.PaymentDetails.Add(d_pod); } b_pod.toCopy <DAL.PaymentDetail>(d_pod); } DB.SaveChanges(); LogDetailStore(PO, LogDetailType.UPDATE); } Clients.Clients(OtherLoginClientsOnGroup).Payment_RefNoRefresh(Payment_NewRefNo(DateTime.Now)); //Journal_SaveByPayment(PO); return(true); } catch (Exception ex) { } return(false); }
public BLL.Payment Payment_DALtoBLL(DAL.Payment d) { BLL.Payment P = d.toCopy <BLL.Payment>(new BLL.Payment()); foreach (var d_Pd in d.PaymentDetails) { P.PDetails.Add(d_Pd.toCopy <BLL.PaymentDetail>(new BLL.PaymentDetail())); } return(P); }
void Journal_SaveByPayment(BLL.Payment P) { var EntryNo = string.Format("PMT-{0}", P.Id); DAL.Journal j = DB.Journals.Where(x => x.EntryNo == EntryNo).FirstOrDefault(); if (j == null) { var pd = P.PDetails.FirstOrDefault(); var ld = DB.Ledgers.Where(x => x.Id == pd.LedgerId).FirstOrDefault(); if (ld.LedgerName.StartsWith("CM-") || ld.LedgerName.StartsWith("WH-") || ld.LedgerName.StartsWith("DL-")) { j = new DAL.Journal(); j.EntryNo = Journal_NewRefNo(DateTime.Now); j.JournalDate = P.PaymentDate; var CId = CompanyIdByLedgerName(ld.LedgerName); if (CId != 0) { var LName = LedgerNameByCompanyId(Caller.CompanyId); j.JournalDetails.Add(new DAL.JournalDetail() { LedgerId = LedgerIdByKeyAndCompany(BLL.DataKeyValue.CashLedger_Key, CId), DrAmt = P.Amount, Particulars = P.Particulars }); j.JournalDetails.Add(new DAL.JournalDetail() { LedgerId = LedgerIdByCompany(LName, CId), CrAmt = P.Amount, Particulars = P.Particulars }); DB.Journals.Add(j); DB.SaveChanges(); } } } else { j.JournalDate = P.PaymentDate; foreach (var jd in j.JournalDetails) { if (jd.CrAmt != 0) { jd.CrAmt = P.Amount; } if (jd.DrAmt != 0) { jd.DrAmt = P.Amount; } jd.Particulars = P.Particulars; } DB.SaveChanges(); } }
void Journal_DeleteByPayment(BLL.Payment P) { var EntryNo = string.Format("PMT-{0}", P.Id); DAL.Journal j = DB.Journals.Where(x => x.EntryNo == EntryNo).FirstOrDefault(); if (j != null) { Journal_Delete(j.Id); } }
public bool Find_JEntryNo(string entryNo, BLL.Payment PO) { DAL.Journal d = DB.Journals.Where(x => x.EntryNo == entryNo & x.Id != PO.Id && x.JournalDetails.FirstOrDefault().Ledger.AccountGroup.CompanyId == Caller.CompanyId).FirstOrDefault(); if (d == null) { return(false); } else { return(true); } }
public bool Find_EntryNo(string entryNo, BLL.Payment PO) { DAL.Payment d = DB.Payments.Where(x => x.EntryNo == entryNo & x.Id != PO.Id && x.Ledger.AccountGroup.FundMasterId == Caller.FundMasterId).FirstOrDefault(); if (d == null) { return(false); } else { return(true); } }
public List <BLL.Payment> Payment_List(int?LedgerId, DateTime dtFrom, DateTime dtTo, string Status) { List <BLL.Payment> lstPayment = new List <BLL.Payment>(); BLL.Payment rp = new BLL.Payment(); foreach (var l in DB.Payments. Where(x => x.PaymentDate >= dtFrom && x.PaymentDate <= dtTo && (x.LedgerId == LedgerId || LedgerId == null) && (Status == "" || x.Status == Status)).ToList()) { rp = new BLL.Payment(); rp.Amount = l.Amount; rp.ChequeDate = l.ChequeDate; rp.ChequeNo = l.ChequeNo; rp.ClearDate = l.ClearDate; rp.EntryNo = l.EntryNo; rp.ExtraCharge = l.ExtraCharge; rp.Id = l.Id; rp.LedgerId = l.LedgerId; rp.LedgerName = l.Ledger.LedgerName; rp.Particulars = l.Particulars; rp.PaymentDate = l.PaymentDate; rp.PaymentMode = l.PaymentMode; rp.PayTo = l.PayTo; rp.RefCode = l.RefCode; rp.RefNo = l.RefNo; rp.Status = l.Status; rp.VoucherNo = l.VoucherNo; //foreach(var l1 in l.PaymentDetails) //{ // rp.PDetail = new BLL.PaymentDetail(); // rp.PDetail.Amount = l1.Amount; // rp.PDetail.Id = l1.Id; // rp.PDetail.LedgerId = l1.LedgerId; // rp.PDetail.LedgerName = l1.Ledger.LedgerName; // rp.PDetail.Particular = l1.Particular; // rp.PDetail.PaymentId = l1.PaymentId; //} lstPayment.Add(rp); } return(lstPayment); }
public BLL.Payment Payment_Find(string SearchText) { BLL.Payment PO = new BLL.Payment(); try { DAL.Payment d = DB.Payments.Where(x => x.EntryNo == SearchText && x.Ledger.AccountGroup.CompanyId == Caller.CompanyId).FirstOrDefault(); DB.Entry(d).Reload(); if (d != null) { d.toCopy <BLL.Payment>(PO); PO.LedgerName = (d.Ledger ?? DB.Ledgers.Find(d.LedgerId) ?? new DAL.Ledger()).LedgerName; foreach (var d_pod in d.PaymentDetails) { BLL.PaymentDetail b_pod = new BLL.PaymentDetail(); d_pod.toCopy <BLL.PaymentDetail>(b_pod); PO.PDetails.Add(b_pod); b_pod.LedgerName = (d_pod.Ledger ?? DB.Ledgers.Find(d_pod.LedgerId) ?? new DAL.Ledger()).LedgerName; } } } catch (Exception ex) { } return(PO); }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.IPayment bll = new BLL.Payment(); if (t == "get_list") { var tb = bll.GetList( ); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_item") { string pay_way = r.Read("pay_way"); var tb = bll.GetItem(pay_way); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "add") { Model.bi_t_payment_info item = new Model.bi_t_payment_info(); item.pay_way = r.Read("pay_way"); item.pay_name = r.Read("pay_name"); item.pay_flag = r.Read("pay_flag"); item.display = r.Read("display"); item.visa_id = r.Read("visa_id"); bll.Add(item); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "change") { Model.bi_t_payment_info item = new Model.bi_t_payment_info(); item.pay_way = r.Read("pay_way"); item.pay_name = r.Read("pay_name"); item.pay_flag = r.Read("pay_flag"); item.display = r.Read("display"); item.visa_id = r.Read("visa_id"); bll.Change(item); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "delete") { string pay_way = r.Read("pay_way"); bll.Delete(pay_way); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else { throw new Exception("未找到方法" + t); } } catch (Exception ex) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); w.Append("errMsg", ex.Message); res = w.ToString(); } }