public void Alert(Result res, string caption) { if (res != null && res.ResultNo != 0) { if (_core != null) { _core.AlertShow(caption, res.ResultDesc, 2); } } }
public void SubMenu_Payment(TouchLinkItem item) { Result res = null; if (tabMain.SelectedTabPageIndex != 1) { res = Msg.Get(EnumMessage.SALES_NOT_SELECTED); } else { _paymentno = ""; res = ucPayment1.PaymentTable(_paymentno); if (res.ResultNo == 0) { _core.AlertShow("Мэдээлэл", "Төлбөр амжилттай хийгдлээ."); decimal[] amount = ucPayment1.GetAmount(); ucBill1.SalesPrint(_batchno, 0, _isvat, amount[4], amount[5], Static.ToStr(res.Param[2]), amount[2]); // Төлбөр амжилттай хийгдвэл шууд формоо хаах item.IsClose = 1; this.Close(); } else { MessageBox.Show(res.ResultNo + " : " + res.ResultDesc); } } }
public void SubMenu_Fine() { try { DataRow r = gridView1.GetFocusedDataRow(); if (r != null) { int fined = Static.ToInt(r["FINED"]); string salesno = Static.ToStr(r["SALESNO"]); decimal custno = Static.ToDecimal(r["CUSTNO"]); string prodno = Static.ToStr(r["PRODNO"]); int itemno = Static.ToInt(r["ITEMNO"]); string prodname = Static.ToStr(r["NAME"]); string rentstatus = Static.ToStr(r["RENTSTATUS"]); string damagenote = Static.ToStr(r["DAMAGENOTE"]); decimal rentminutes = Static.ToDecimal(r["RENTMINUTES"]); if (fined == 1) { frmRegFine frm = new frmRegFine(_core, salesno, custno, prodno, 0, itemno, prodname, rentstatus, damagenote, rentminutes); frm.StartPosition = FormStartPosition.CenterScreen; DialogResult res = frm.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { ReadRecord(_pledgeno); } } else { if (_core != null) { _core.AlertShow("Торгууль төлөх", "Төлөх торгууль алга байна.", 1); } } } } catch (Exception ex) { } }
private void btnPrint_Click(object sender, EventArgs e) { try { PrintBillContents(); //string ret = _core.Printer.Open(); //if (!string.IsNullOrEmpty(ret)) //{ // _core.AlertShow("Билл Хэвлэх", ret, 2); // return; //} //_core.Printer.Print((string)memoEdit1.EditValue); //_core.Printer.Close(); this.Close(); } catch (Exception ex) { _core.AlertShow("Билл Хэвлэх", ex.Message); } }
private void ucNumpad1_EventClickExtraButton(int num) { switch (num) { case 2: decimal qty = Static.ToDecimal(numQty.EditValue); if (qty < 0) { _core.AlertShow("Нэмэлт борлуулалт", "Тоо ширхэг буруу байна.", 2); return; } _qty = qty; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); break; case 3: this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); break; } }
public string ShiftClosure_PrepareBill(string posno, int shiftno) { Result res = null; StringBuilder sb = new StringBuilder(); DataTable dt = null; DataRow r = null; object hash = null; try { object[] param = new object[] { posno, shiftno }; res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 211, 211009, 211001, param); if (res.ResultNo != 0) { goto OnExit; } #region Биллийн формат файлыг унших string filename = string.Format("{0}\\Bill\\BillFormat.txt", _core.ApplicationPath); if (System.IO.File.Exists(filename)) { string s = System.IO.File.ReadAllText(filename); bool success = false; hash = JSON.JsonDecode(s, ref success); if (!success) { throw new Exception("Биллын формат файл буруу байна."); } } #endregion #region Толгойн custom мэдээллийг унших object hdr = Core.Core.JPathGet((Hashtable)hash, "header"); object ftr = Core.Core.JPathGet((Hashtable)hash, "footer"); if (hdr == null || ftr == null || !(hdr is ArrayList) || !(ftr is ArrayList)) { throw new Exception("Биллын формат файл буруу байна."); } ArrayList list = (ArrayList)hdr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion #region Биллийн толгой бэлдэх dt = res.Data.Tables[0]; if (dt != null && dt.Rows.Count > 0) { r = dt.Rows[0]; #region Field values string posname = Static.ToStr(r["POSNAME"]); decimal cash_amount = Static.ToDecimal(r["CASH_AMOUNT"]); decimal card_amount = Static.ToDecimal(r["CARD_AMOUNT"]); decimal other_amount = Static.ToDecimal(r["OTHER_AMOUNT"]); int cash_count = Static.ToInt(r["CASH_COUNT"]); int card_count = Static.ToInt(r["CARD_COUNT"]); int other_count = Static.ToInt(r["OTHER_COUNT"]); decimal cashin_amount = Static.ToDecimal(r["CASHIN_AMOUNT"]); decimal cashout_amount = -Static.ToDecimal(r["CASHOUT_AMOUNT"]); int cashin_count = Static.ToInt(r["CASHIN_COUNT"]); int cashout_count = Static.ToInt(r["CASHOUT_COUNT"]); decimal total_amount = Static.ToDecimal(r["TOTAL_AMOUNT"]); decimal refund_amount = Static.ToDecimal(r["REFUND_AMOUNT"]); int sales_count = Static.ToInt(r["SALES_COUNT"]); int refund_count = Static.ToInt(r["REFUND_COUNT"]); #endregion posname = " ".PadLeft((40 - posname.Length) / 2) + posname; sb.AppendFormat("{0}\r\n", posname.ToUpper()); sb.Append(" [Cashier Closure]\r\n"); sb.AppendFormat("{0,-16:yyyy/MM/dd HH:mm} Pos:{1,4} Shft:{2,3}\r\n", DateTime.Now, Static.SubStr(posno, 0, 4), shiftno); sb.AppendLine("========================================"); sb.AppendLine("[Deposit Total]"); sb.AppendFormat(" Cash : {0,-4} {1,15:#,##0.00}\r\n", cash_count, cash_amount); sb.AppendFormat(" Card : {0,-4} {1,15:#,##0.00}\r\n", card_count, card_amount); sb.AppendFormat(" Other : {0,-4} {1,15:#,##0.00}\r\n", other_count, other_amount); sb.AppendLine("----------------------------------------"); sb.AppendFormat(" Total : {0,-4} {1,15:#,##0.00}\r\n", cash_count + card_count + other_count, cash_amount + card_amount + other_amount); sb.AppendLine("----------------------------------------"); sb.AppendLine("[Cash Total]"); sb.AppendFormat(" Start Amt : {0,-4} {1,15:#,##0.00}\r\n", cashin_count, cashin_amount); sb.AppendFormat(" Cash Sale : {0,-4} {1,15:#,##0.00}\r\n", cash_count, cash_amount); sb.AppendFormat(" Deposit Amt : {0,-4} {1,15:#,##0.00}\r\n", cashin_count + cash_count, cashin_amount + cash_amount); sb.AppendFormat(" Cash Total : {0,-4} {1,15:#,##0.00}\r\n", cashout_count, cashout_amount); sb.AppendLine("----------------------------------------"); sb.AppendFormat(" Over/Lack : {0,15:#,##0.00}\r\n", cashin_amount + cash_amount + cashout_amount); sb.AppendLine("----------------------------------------"); sb.AppendLine("[Sale Total]"); sb.AppendFormat(" Sale : {0,-4} {1,15:#,##0.00}\r\n", sales_count, total_amount); sb.AppendFormat(" Return : {0,-4} {1,15:#,##0.00}\r\n", refund_count, refund_amount); sb.AppendLine("----------------------------------------"); sb.AppendFormat(" Total : {0,-4} {1,15:#,##0.00}\r\n", sales_count + refund_count, total_amount + refund_amount); sb.AppendLine("========================================"); sb.Append("\r\n\r\n"); sb.AppendFormat("Cashier:...............{0}\r\n" , (string.IsNullOrEmpty(_core.RemoteObject.User.UserFName) ? "" : Static.SubStr(_core.RemoteObject.User.UserFName, 0, 1) + ".") + _core.RemoteObject.User.UserLName ); sb.Append("\r\n\r\n"); } #endregion #region Биллийн сүүл бэлдэх list = (ArrayList)ftr; foreach (object o in list) { sb.AppendLine(Static.ToStr(o)); } #endregion } catch (Exception ex) { res = new Result(211009, ex.ToString()); } OnExit: if (res != null && res.ResultNo != 0) { _core.AlertShow("Ээлж хаалт", res.ResultDesc); } memoEdit1.EditValue = sb.ToString(); status = 0; return(sb.ToString()); }
public Result BarcodeReaderGet(string barcode) { Result res = null; try { #region Баркод уягдсан хэрэгслийн кодыг авах if (_dict == null || _dict.Count < 5) { res = new Result(9, "Жагсаалт мэдээлэл бүрэн татагдаагүй байна."); goto OnExit; } DataTable dt = (DataTable)_dict[3]; DataRow[] rows = dt.Select(string.Format("BARCODE='{0}'", barcode)); if (rows == null || rows.Length < 1) { res = new Result(9, "Бүртгэлгүй баркод байна."); goto OnExit; } string prodno_barcode = Static.ToStr(rows[0]["INVID"]); #endregion #region Баркодоор хэрэгслийн бичлэгийг олох dt = (DataTable)gridControl1.DataSource; if (dt == null) { res = new Result(9, "Түрээсийн хэрэгсэл олдсонгүй."); goto OnExit; } rows = dt.Select(string.Format("PRODNO='{0}'", prodno_barcode)); if (rows == null || rows.Length <= 0) { res = new Result(9, string.Format("[{0}] Түрээсийн хэрэгсэл олдсонгүй.", prodno_barcode)); goto OnExit; } DataRow r = null; foreach (DataRow i in rows) { int rs = Static.ToInt(i["RENTSTATUS"]); string bc = Static.ToStr(i["BARCODE"]); if (rs == 0) { r = i; } else if (rs == 1 && bc == barcode) { /*********************************************** * Олголт хийчихсэн барааны бар код орж ирвэл * шууд хүлээн авах. ***********************************************/ r = i; break; } } if (r == null) { res = new Result(9, "Тохирох түрээсийн хэрэгсэл олдсонгүй."); goto OnExit; } #endregion #region Deliver or Receive _salesno = Static.ToStr(r["SALESNO"]); int itemno = Static.ToInt(r["ITEMNO"]); decimal custno = Static.ToDecimal(r["CUSTNO"]); string prodno = Static.ToStr(r["PRODNO"]); string bcode = Static.ToStr(r["BARCODE"]); int rentstatus = Static.ToInt(r["RENTSTATUS"]); if (rentstatus == 0) { res = Deliver(_salesno, custno, itemno, prodno, barcode, _userno, _userstate); } else if (rentstatus == 1) { res = Receive(_salesno, custno, itemno, prodno, barcode, _userno, _userstate); } else { res = new Result(9, "Тохирох түрээсийн хэрэгсэл олдсонгүй."); } #endregion } catch (Exception ex) { res = new Result(9, ex.ToString()); } OnExit: if (res != null && res.ResultNo != 0) { _core.AlertShow("Мэдээлэл", res.ResultDesc); } return(res); }