//管理员查询相应用户名的记录 public DataTable search_User_BillInformation(Model.Bill b) { DataTable dt = new DataTable(); IDataParameter[] parameter = { new SqlParameter("@username", SqlDbType.VarChar, 10) }; parameter[0].Value = b.Username; dt = pr.GetDataTable("search_User_BillInformation", parameter); //string SQL = "select * from [bill] where username='******'"; //dt = db.SQLGetDataTable(SQL); return(dt); /*----------------------------------------------------------------------------------*/ //DataTable dt = new DataTable(); //string SQL = "select * from [bill] where username='******'"; //dt = db.SQLGetDataTable(SQL); //return dt; }
//管理员查询相应的用户名和日期 public DataTable searchPointedBillInformation(Model.Bill b, string date) { DataTable dt = new DataTable(); IDataParameter[] parameter = { new SqlParameter("@username", SqlDbType.VarChar, 10), new SqlParameter("@date", SqlDbType.VarChar, 200) }; parameter[0].Value = b.Username; parameter[1].Value = date; dt = pr.GetDataTable("searchPointedBillInformation", parameter); //string SQL = "select * from [bill] where username='******' and Convert(varchar(200),datetime,111)='" + date + "'"; //dt = db.SQLGetDataTable(SQL); return(dt); /*-------------------------------------------------------------------------------------------------------------------------------------------*/ //DataTable dt = new DataTable(); //string SQL = "select * from [bill] where username='******' and Convert(varchar(200),datetime,111)='" + date + "'"; //dt = db.SQLGetDataTable(SQL); //return dt; }
//搜索账单号确保随机数不重复 public bool SearchNo(Model.Bill b) { bool flag = false; DataTable dt = new DataTable(); IDataParameter[] parameter = { new SqlParameter("@billno", SqlDbType.Int) }; parameter[0].Value = b.Billno; dt = pr.GetDataTable("SearchNo", parameter); if (dt.Rows.Count > 0) { return(flag); } else { flag = true; return(flag); } /*-------------------------------------------------------------------------------*/ //bool flag = false; //DataTable dt = new DataTable(); //string SQL = "select * from [bill] where billno='" + b.Billno + "'"; //dt = db.SQLGetDataTable(SQL); //if (dt.Rows.Count > 0) //{ // return flag; //} //else //{ // flag = true; // return flag; //} }
public UpdateBillCommand(Model.Bill bill) { _bill = bill; }
//生成账单 public bool ProduceBill(Model.Bill b) { DataTable dt = new DataTable(); bool flag = false; IDataParameter[] parameter = { new SqlParameter("@username", SqlDbType.VarChar, 10), new SqlParameter("@ischecked", SqlDbType.VarChar, 10) }; parameter[0].Value = b.Username; parameter[1].Value = "NULL"; dt = pr.GetDataTable("ProduceBill", parameter); if (dt.Rows.Count > 0) { IDataParameter[] parameter1 = { new SqlParameter("@username", SqlDbType.VarChar, 10), new SqlParameter("@ischecked", SqlDbType.VarChar, 10) }; parameter1[0].Value = b.Username; parameter1[1].Value = "NULL"; int sumprice = pr.ExcuteProReturnInt("ProduceBill1", parameter1); IDataParameter[] parameter2 = { new SqlParameter("@billno", SqlDbType.Int), new SqlParameter("@username", SqlDbType.VarChar, 10), new SqlParameter("@totalprice", SqlDbType.VarChar, 10) }; parameter2[0].Value = b.Billno; parameter2[1].Value = b.Username; parameter2[2].Value = sumprice; pr.ExcutePro("ProduceBill2", parameter2); IDataParameter[] parameter3 = { new SqlParameter("@username", SqlDbType.VarChar, 10) }; parameter3[0].Value = b.Username; pr.ExcutePro("ProduceBill3", parameter3); flag = true; return(flag); } else { return(flag); } /*----------------------------------------------------------------------------------------------------------------------------------*/ //DataTable dt = new DataTable(); //bool flag = false; //string SQL = "select * from [order] where username='******' and ischecked='NULL'"; //dt = db.SQLGetDataTable(SQL); //if (dt.Rows.Count > 0) //{ // string SQL1 = "select sum(sumprice) from [order] where username='******' and ischecked='NULL'"; // int sumprice = db.SQLExecuteReturnInt(SQL1); // string SQL2 = "insert into[bill](billno,username,totalprice)values('"+b.Billno+"','" + b.Username + "','" + sumprice + "')"; // db.SQLExecute(SQL2); // string SQL3 = "update [order] set ischecked='checked' where username='******'"; // db.SQLExecute(SQL3); // flag = true; // return flag; //} //else //{ // return flag; //} }
async Task <(Model.Bill, Model.Payment)> GenerateBillPayment(DbContext dbContext) { var gst = await FinanceHelper.GetGST(dbContext); var gstAmount = _param.Amount * gst; var amount = _param.Amount - gstAmount; var code = await dbContext.Transactioncode.GetTransactionCodeByCode( TransactionCodes.CompositionSum); if (code == null) { throw new BadRequestException("Composition sum code not setup. Please contact administrator."); } await dbContext.Account.InsertOrReplace(new Account { ID = _param.PayerID, Name = _param.PayerName }); // Insert/replace contact peron await PersonHelper.InsertOrReplace(dbContext, _param.ContactPerson); var bill = new Model.Bill { Status = BillStatus.Pending, Type = BillType.CompositionSum, RefNo = _param.RefID, Amount = amount, GSTAmount = gstAmount, GST = gst, RefID = _param.RefID, CustomerID = _param.PayerID, CustomerName = _param.PayerName, IssuedOn = DateTime.UtcNow, LineItems = new List <BillLineItem> { new BillLineItem { SectionIndex = 0, Section = "Item Details", Index = 1, CodeID = code.ID, Descr = code.Text, Amount = amount, GSTAmount = gstAmount, GST = gst, WillRecord = true } } }; bill.ID = await dbContext.Bill.InsertBill(bill); var payment = new Model.Payment { AltID = _param.BankAccountName, RefNo = _param.RefNo, Status = PaymentStatus.Pending, Mode = _param.Mode, Method = _param.Method, TransactionNo = Guid.NewGuid().ToString(), AccountID = _param.PayerID, Name = _param.PayerName, Amount = amount, GSTAmount = gstAmount, GST = gst, PaidOn = DateTime.UtcNow, ContactPersonID = _param.ContactPerson?.ID ?? null, ContactPerson = _param.ContactPerson, Bills = new List <Model.Bill> { bill } }; payment.ID = await dbContext.Payment.Insert(payment); await dbContext.Payment.MapBill(payment.ID, bill.ID); if (_param.Mode == PaymentMode.Offline) { Model.Bank bank = null; var banks = await dbContext.Bank.Query( new BankFilter { AccountName = _param.BankAccountName }); if ((banks?.Count() ?? 0) == 1) { bank = banks.First(); await dbContext.Payment.MapBank(payment.ID, bank.ID); } } return(bill, payment); }
public DataTable search_User_BillInformation(Model.Bill b) { return(bill.search_User_BillInformation(b)); }
public DataTable searchPointedBillInformation(Model.Bill b, string date) { return(bill.searchPointedBillInformation(b, date)); }
public bool SearchNo(Model.Bill b) { return(bill.SearchNo(b)); }
public bool ProduceBill(Model.Bill b) { return(bill.ProduceBill(b)); }