public List <receipt> getReceipt(string code, string target) { DAReceipt da = new DAReceipt(); ListDictionary Params = new ListDictionary(); Params.Add("@code", code); Params.Add("@target", target); DataSet ds = da.getReceipt(Params); List <receipt> lr = new List <receipt>(); receipt r; foreach (DataRow item in ds.Tables[0].Rows) { r = new receipt(); r.PayBy = BLCtrl.getInt(item, "PayBy", 0); r.Bank = BLCtrl.getInt(item, "Bank", 0); r.BankAccount = BLCtrl.getString(item, "BankAccount", ""); r.Branch = BLCtrl.getString(item, "Branch", ""); r.CardsKind = BLCtrl.getString(item, "CardsKind", ""); r.chequaNum = BLCtrl.getString(item, "chequaNum", ""); r.Code = BLCtrl.getInt(item, "Code", 0); r.CreditCard = BLCtrl.getString(item, "CreditCard", ""); r.name = BLCtrl.getString(item, "name", ""); r.PaymentNum = BLCtrl.getInt(item, "PaymentNum", 0); r.receiptDate = BLCtrl.getDateTime(item, "receiptDate", DateTime.Today); r.receiptNum = BLCtrl.getInt(item, "receiptNum", 0); r.Sum = (double)BLCtrl.getDecimal(item, "Sum", 0M); r.Validity = BLCtrl.getString(item, "Validity", ""); lr.Add(r); } return(lr); }
internal static int SubmitOrder(Order order) { receipt rcpt = new receipt(); rcpt.sum = (decimal)order.Total; rcpt.date = DateTime.Now; db.receipts.InsertOnSubmit(rcpt); db.SubmitChanges(); if (rcpt.receipt_id != 0) { receipt_ref_user rru = new receipt_ref_user(); rru.receipt_id = rcpt.receipt_id; rru.user_id = order.UserId; db.receipt_ref_users.InsertOnSubmit(rru); db.SubmitChanges(); foreach (var item in order.Cart) { receipet_ref_product rrp = new receipet_ref_product(); rrp.product_id = item.GetProduct().product_id; rrp.quantity = item.m_qty; rrp.receipt_id = rcpt.receipt_id; db.receipet_ref_products.InsertOnSubmit(rrp); db.SubmitChanges(); } } return(rcpt.receipt_id); }
private static int Calculate() { double S = 0; double Y = 0; int sum = 0; for (int i = 0; i < receiptList.Count; i++) { S = 0; if (receiptList[i].isValid == false) { continue; } else { for (int j = 1; j < 9; j++) { S += (receiptList[i].VAT[8 - j] - 48) * Math.Pow(2, j); } } Y = S % 11; if (Y == 10 && (receiptList[i].VAT[8] - 48) == 0 || (receiptList[i].VAT[8] - 48) == Y) { receipt newReceipt = new receipt(); newReceipt = receiptList[i]; newReceipt.isValid = true; receiptList[i] = newReceipt; sum += int.Parse(newReceipt.price); } } return(sum); }
public IHttpActionResult Postreceipt(receipt receipt) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.receipt.Add(receipt); try { db.SaveChanges(); } catch (DbUpdateException) { if (receiptExists(receipt.recode)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = receipt.recode }, receipt)); }
public IHttpActionResult Putreceipt(string id, receipt receipt) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != receipt.recode) { return(BadRequest()); } db.Entry(receipt).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!receiptExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
//Tao phieu nhap public bool TaoPhieuXuat(int pID, string pNgayXuat) { try { receipt check = _Coffee.receipts.Where(t => t.ID.Equals(pID)).FirstOrDefault(); if (check != null) { return(false);//ton tai ma pn } else { receipt add = new receipt(); add.ID = pID; add.ID_ACCOUNT = 1; add.CREATE_AT = Convert.ToDateTime(pNgayXuat); _Coffee.receipts.InsertOnSubmit(add); _Coffee.SubmitChanges(); return(true); } } catch { return(false); } }
public ActionResult DeleteConfirmed(string id) { receipt receipt = db.receipt.Find(id); db.receipt.Remove(receipt); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddPatiantReceipt(item FormData)//הוספת קבלה חדשה למטופלת { try { Session.Timeout += 5;//session הגדלת ה List <receipt> receiptList = new List <receipt>(); receipt r = null; BLAddReceipt b = new BLAddReceipt(); int recNum = b.getTopReceiptNum() + 1; //מספר הזמנה חדש DateTime DateR = DateTime.Now; //תאריך קבלה הוא תמיד תאריך של היום for (int i = 0; i < FormData.Sum.Count(); i++) //מילוי נתונים { r = new receipt(); r.receiptNum = recNum; r.Bank = FormData.Bank[i]; r.BankAccount = FormData.BankAccount[i]; r.Branch = FormData.Branch[i]; r.CardsKind = FormData.CardsKind[i]; r.chequaNum = FormData.chequaNum[i]; r.CreditCard = FormData.CreditCard[i]; r.name = FormData.name[i]; r.PayBy = FormData.PayBy[i]; r.PaymentNum = i + 1; r.Validity = FormData.Validity[i]; r.receiptDate = DateR; r.Sum = FormData.Sum[i]; receiptList.Add(r); } BLAddReceipt bl = new BLAddReceipt(); foreach (var item in receiptList)//הכנסת שורת התשלום לטבלה בבסיס הנתונים { int result = bl.AddPatiantReceipt(item.receiptDate, item.Sum, item.PayBy, item.chequaNum, item.Bank, item.PaymentNum, item.Branch, item.BankAccount, item.CardsKind, item.CreditCard, item.Validity, item.name, item.receiptNum, Session["Patiant"].ToString()); if (result != 0) { ViewBag.messege = "משהו השתבש"; return(View()); } } //סגירת חלונית הוספת קבלה,רענון דף רשימת קבלות כדי לראות את הקבלה שנוספה TempData["messege"] = "קבלה נוספה בהצלחה"; return(Content(@"<body> <script type='text/javascript'> window.opener.location.reload(); window.close(); </script> </body>")); } catch (Exception e) { ViewBag.messege = e.ToString(); return(View()); } }
void sendReceipt(string filename) { receipt r = new receipt(); r.filepath = filename; string jsonstr = JsonUtility.ToJson(r); byte[] bytesToSend = ASCIIEncoding.ASCII.GetBytes(jsonstr); Console.WriteLine("Sending"); stream.Write(bytesToSend, 0, bytesToSend.Length); }
public ActionResult Edit([Bind(Include = "recode,reloan,redate,remoney,rerecive,rechange,remem")] receipt receipt) { if (ModelState.IsValid) { db.Entry(receipt).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.reloan = new SelectList(db.loan, "loancode", "loanmem", receipt.reloan); return(View(receipt)); }
public IHttpActionResult Getreceipt(string id) { receipt receipt = db.receipt.Find(id); if (receipt == null) { return(NotFound()); } return(Ok(receipt)); }
public receipt LoadTTPX(int pID) { try { receipt check = _Coffee.receipts.Where(t => t.ID.Equals(pID)).FirstOrDefault(); return(check); } catch { return(null); } }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { getRow(e); receipt selectedReceipt = datagrid.CurrentItem as receipt; EntityFactory.Receipt = selectedReceipt; EntityFactory.Reservation = selectedReceipt.reservation; EntityFactory.Client = selectedReceipt.client; CreateReceipt createReceipt = new CreateReceipt(); createReceipt.SetAllFields(); Content = createReceipt; }
public receipt Insert_receipt_select(int ID) { receipt = receipt.Select(ID); Insert_Account_ID_txt.Text = Convert.ToString(receipt.Account_ID); Insert_Check_Num_txt.Text = Convert.ToString(receipt.Check_Num); Insert_DLN_txt.Text = Convert.ToString(receipt.DLN); Insert_Phone_txt.Text = Convert.ToString(receipt.Phone); Insert_Pay_Type_txt.Text = Convert.ToString(receipt.Pay_Type); Insert_Amount_txt.Text = Convert.ToString(receipt.Amount); Insert_Transfer_txt.Text = Convert.ToString(receipt.Transfer); Insert_Recieve_txt.Text = Convert.ToString(receipt.Recieve); return receipt; }
public object GetProduct(receipt pRec) { try { var p = from d in pRec.receipt_details select d; return(p); } catch (Exception ex) { throw ex; } }
public bool Update(receipt pReceipt) { try { pReceipt.modified = DateTime.Now; db.SubmitChanges(); return(true); } catch (Exception ex) { throw ex; } }
public receipt Insert_receipt_select(int ID) { receipt = receipt.Select(ID); Insert_Account_ID_txt.Text = Convert.ToString(receipt.Account_ID); Insert_Check_Num_txt.Text = Convert.ToString(receipt.Check_Num); Insert_DLN_txt.Text = Convert.ToString(receipt.DLN); Insert_Phone_txt.Text = Convert.ToString(receipt.Phone); Insert_Pay_Type_txt.Text = Convert.ToString(receipt.Pay_Type); Insert_Amount_txt.Text = Convert.ToString(receipt.Amount); Insert_Transfer_txt.Text = Convert.ToString(receipt.Transfer); Insert_Recieve_txt.Text = Convert.ToString(receipt.Recieve); return(receipt); }
public bool KiemTraTonTai(receipt pnh, product sp) { try { var p = from d in pnh.receipt_details where d.product_id.Equals(sp.id) select d; return(p.Count() == 1); } catch (Exception ex) { throw ex; } }
public IHttpActionResult Deletereceipt(string id) { receipt receipt = db.receipt.Find(id); if (receipt == null) { return(NotFound()); } db.receipt.Remove(receipt); db.SaveChanges(); return(Ok(receipt)); }
// GET: receipts/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } receipt receipt = db.receipt.Find(id); if (receipt == null) { return(HttpNotFound()); } return(View(receipt)); }
public bool Insert(receipt pReceipt) { try { pReceipt.created = DateTime.Now; db.receipts.InsertOnSubmit(pReceipt); db.SubmitChanges(); return(true); } catch (Exception ex) { throw ex; } }
private void gvPhieuNhapHang_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (gvPhieuNhapHang.SelectedRowsCount != 1) { return; } r = (receipt)gvPhieuNhapHang.GetFocusedRow(); dpNgayLap.EditValue = r.created; dpNgayLap.DateTime = r.created; txtMaPhieuNhap.Text = r.id; lkNhaCungCap.EditValue = r.provider.id; lkNhanVien.EditValue = r.staff.id; dgvChiTietNhapHang.DataSource = busNhapHang.GetProduct(r); }
// GET: receipts/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } receipt receipt = db.receipt.Find(id); if (receipt == null) { return(HttpNotFound()); } ViewBag.reloan = new SelectList(db.loan, "loancode", "loanmem", receipt.reloan); return(View(receipt)); }
private void btnAccept_Click(object sender, RoutedEventArgs e) { if (currentRow != null) { receipt newReciept = currentRow.Item as receipt; datagrid.Items.Remove(newReciept); datagrid.Items.Refresh(); term.Delete(newReciept.id); tbDelete.Text = "Uspješno ste obrisali podatke o računu!"; } else { tbDelete.Text = "Podaci o računu nisu obrisani!"; } btnAccept.Visibility = btnCancel.Visibility = Visibility.Collapsed; }
public receipt receipt_insert() { receipt.Account_ID = Convert.ToInt32(Insert_Account_ID_txt.Text); receipt.Check_Num = Convert.ToInt32(Insert_Check_Num_txt.Text); receipt.DLN = Convert.ToInt32(Insert_DLN_txt.Text); receipt.Phone = Convert.ToInt32(Insert_Phone_txt.Text); receipt.Pay_Type = Convert.ToInt32(Insert_Pay_Type_txt.Text); receipt.Amount = Convert.ToInt32(Insert_Amount_txt.Text); receipt.Transfer = Convert.ToBoolean(Insert_Transfer_txt.Text); receipt.Recieve = Convert.ToBoolean(Insert_Recieve_txt.Text); receipt = receipt.Insert(receipt); Insert_receipt_GridView.DataBind(); Update_receipt_GridView.DataBind(); Delete_receipt_GridView.DataBind(); return(receipt); }
public receipt receipt_update(int ID) { receipt = receipt.Select(ID); receipt.Receipt_ID = Convert.ToInt32(Update_Receipt_ID_txt.Text); receipt.Account_ID = Convert.ToInt32(Update_Account_ID_txt.Text); receipt.Check_Num = Convert.ToInt32(Update_Check_Num_txt.Text); receipt.DLN = Convert.ToInt32(Update_DLN_txt.Text); receipt.Phone = Convert.ToInt32(Update_Phone_txt.Text); receipt.Pay_Type = Convert.ToInt32(Update_Pay_Type_txt.Text); receipt.Amount = Convert.ToInt32(Update_Amount_txt.Text); receipt.Transfer = Convert.ToBoolean(Update_Transfer_txt.Text); receipt.Recieve = Convert.ToBoolean(Update_Recieve_txt.Text); receipt.Update(receipt); Insert_receipt_GridView.DataBind(); Update_receipt_GridView.DataBind(); Delete_receipt_GridView.DataBind(); return(receipt); }
/// <summary> /// Insert Receipt /// Insert into receipt_by_receipt_id /// </summary> /// <returns></returns> public async Task <ResultModel <receipt> > AddReceiptAsync() { var guid = Guid.NewGuid(); receipt receiptAdd = new receipt { businessUnit = "wireless", receiptId = guid, domain = "wireless", receiptType = ReceiptType.add.ToString(), user = Environment.UserName, dateCreated = TimeUuid.NewId(), dateUpdate = null }; try { Stopwatch sw = Stopwatch.StartNew(); CqlQueryOptions qo = new CqlQueryOptions().SetConsistencyLevel(ConsistencyLevel.LocalOne); await mapper.InsertAsync(receiptAdd, qo); sw.Stop(); File.AppendAllText(@"C:\Guids.txt", $"AddReceiptAsync: Time taken: {sw.Elapsed.Milliseconds}ms\r\n"); } catch (Exception ex) { Console.WriteLine(ex.Message); return(new ResultModel <receipt> { resultCode = ResultStatus.failure }); } return(new ResultModel <receipt> { resultContent = receiptAdd, resultCode = ResultStatus.success }); }
private void cbo_MaPhieuBan_SelectedIndexChanged(object sender, EventArgs e) { try { receipt pn = _px.LoadTTPX(Int32.Parse(cbo_MaPhieuBan.SelectedValue.ToString())); if (pn != null) { txtMaPhieuBan.Text = pn.ID.ToString(); txtNgayBan.Text = Convert.ToDateTime(pn.CREATE_AT).ToString("dd/MM/yyyy"); txtThanhTien.Text = pn.SUM_MONEY.ToString(); //Load them thong tin chi tiet phieu nhap o day LoadCTPX(pn.ID); txtThanhTien.Text = TinhThanhTien().ToString(); } } catch { return; } }
private static bool Input() { dataString = Console.ReadLine(); while (dataString != "") { dataArray = dataString.Split(' '); if (dataArray.Length == 2) { receipt r = new receipt(); if (dataArray[0].Length == 8 || dataArray[0].Length == 9) { if (dataArray[0].Length == 8) { r.VAT = dataArray[0].Insert(0, "0"); } else { r.VAT = dataArray[0]; } r.price = dataArray[1]; r.isValid = true; receiptList.Add(r); } else { r.VAT = dataArray[0]; r.price = dataArray[1]; r.isValid = false; receiptList.Add(r); } } else { return(false); } dataString = Console.ReadLine(); } return(true); }
private void btnLuu_Click(object sender, EventArgs e) { if (dpNgayLap.EditValue == null) { CheckLoi(lbNgayLap.Text); dpNgayLap.Focus(); } if (lkNhanVien.EditValue == null) { CheckLoi(lkNhanVien.Text); lkNhanVien.Focus(); } if (lkNhaCungCap.EditValue == null) { CheckLoi(lkNhaCungCap.Text); lkNhaCungCap.Focus(); } r = new receipt(); r.id = txtMaPhieuNhap.Text; r.created = (DateTime)dpNgayLap.EditValue; staff st = (staff)lkNhanVien.GetSelectedDataRow(); provider pr = (provider)lkNhaCungCap.GetSelectedDataRow(); r.staff = st; r.provider = pr; if (busNhapHang.Save()) { XtraMessageBox.Show("Lưu thành công", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); btnDanhMucLamMoi.PerformClick(); } else { XtraMessageBox.Show("Lưu thất bại", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } txtMaPhieuNhap.Text = null; dpNgayLap.EditValue = lkNhaCungCap.EditValue = lkNhanVien.EditValue = null; panelControl4.Enabled = false; }
public ActionResult Create(receipt receipt) { if (Session["monthleft"] == null) { Session["monthleft"] = 1; } var loans = db.loan.Where(x => x.loancode == receipt.reloan).FirstOrDefault(); if (receipt.rerecive - (loans.loadpermonth * Convert.ToInt32(Session["monthleft"])) >= 0) { if (Convert.ToInt32(Session["monthleft"]) == 1) { loans.loanmonth = loans.loanmonth - 1; } else { loans.loanmonth = loans.loanmonth - Convert.ToInt32(Session["monthleft"]); } loans.loanmoney = loans.loanmoney - (loans.loadpermonth * Convert.ToInt32(Session["monthleft"])); receipt.remoney = loans.loadpermonth * Convert.ToInt32(Session["monthleft"]); var date = DateTime.Now; receipt.recode = date.Day.ToString() + date.Month.ToString() + receipt.reloan.ToString() + db.receipt.Count().ToString(); receipt.redate = DateTime.UtcNow; receipt.rechange = receipt.rerecive - receipt.remoney; receipt.remem = Session["User"].ToString(); loans.loanlastdate = DateTime.UtcNow; In_Ex income = new In_Ex(); income.expenditure = 0; income.income = receipt.remoney; income.date = DateTime.UtcNow; db.In_Ex.Add(income); db.receipt.Add(receipt); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.reloan = new SelectList(db.loan, "loancode", "loanmem", receipt.reloan); return(RedirectToAction("Create", "receipts", new { idcard = Session["idcardgetname"] })); }
public receipt receipt_update(int ID) { receipt = receipt.Select(ID); receipt.Receipt_ID = Convert.ToInt32(Update_Receipt_ID_txt.Text); receipt.Account_ID = Convert.ToInt32(Update_Account_ID_txt.Text); receipt.Check_Num = Convert.ToInt32(Update_Check_Num_txt.Text); receipt.DLN = Convert.ToInt32(Update_DLN_txt.Text); receipt.Phone = Convert.ToInt32(Update_Phone_txt.Text); receipt.Pay_Type = Convert.ToInt32(Update_Pay_Type_txt.Text); receipt.Amount = Convert.ToInt32(Update_Amount_txt.Text); receipt.Transfer = Convert.ToBoolean(Update_Transfer_txt.Text); receipt.Recieve = Convert.ToBoolean(Update_Recieve_txt.Text); receipt.Update(receipt); Insert_receipt_GridView.DataBind(); Update_receipt_GridView.DataBind(); Delete_receipt_GridView.DataBind(); return receipt; }
public Print_Receipt(DataSet ds) { receipt = new receipt(); receipt.SetDataSource(ds); InitializeComponent(); }
public receipt receipt_insert() { receipt.Account_ID = Convert.ToInt32(Insert_Account_ID_txt.Text); receipt.Check_Num = Convert.ToInt32(Insert_Check_Num_txt.Text); receipt.DLN = Convert.ToInt32(Insert_DLN_txt.Text); receipt.Phone = Convert.ToInt32(Insert_Phone_txt.Text); receipt.Pay_Type = Convert.ToInt32(Insert_Pay_Type_txt.Text); receipt.Amount = Convert.ToInt32(Insert_Amount_txt.Text); receipt.Transfer = Convert.ToBoolean(Insert_Transfer_txt.Text); receipt.Recieve = Convert.ToBoolean(Insert_Recieve_txt.Text); receipt = receipt.Insert(receipt); Insert_receipt_GridView.DataBind(); Update_receipt_GridView.DataBind(); Delete_receipt_GridView.DataBind(); return receipt; }
protected void Update_Select_Record(object sender, EventArgs e) { receipt = Update_receipt_select(Convert.ToInt32(Update_receipt_GridView.SelectedValue)); }
protected void UPDATE(object sender, EventArgs e) { receipt = receipt_update(Convert.ToInt32(Update_receipt_GridView.SelectedValue)); }
protected void Insert_Select_Record(object sender, EventArgs e) { receipt = Insert_receipt_select(Convert.ToInt32(Insert_receipt_GridView.SelectedValue)); }
protected void INSERT(object sender, EventArgs e) { receipt = receipt_insert(); }