public ProductReserveData GetData(double loid) { ProductReserveData data = new ProductReserveData(); if (DALObj.GetDataByLOID(loid, null)) { data.LOID = DALObj.LOID; data.ACTIVE = DALObj.ACTIVE; data.CADDRESS = DALObj.CADDRESS; data.CEMAIL = DALObj.CEMAIL; data.CFAX = DALObj.CFAX; data.CLASTNAME = DALObj.CLASTNAME; data.CNAME = DALObj.CNAME; data.CODE = DALObj.CODE; data.CREATEBY = DALObj.CREATEBY; data.CTEL = DALObj.CTEL; data.CTITLE = DALObj.CTITLE; data.CUSTOMER = DALObj.CUSTOMER; data.DUEDATE = DALObj.DUEDATE; data.REQDATE = DALObj.REQDATE; data.GRANDTOT = DALObj.GRANDTOT; data.REMARK = DALObj.REMARK; data.RESERVEDATE = DALObj.RESERVEDATE; data.REQUISITIONTYPE = DALObj.REQUISITIONTYPE; data.STATUS = DALObj.STATUS; data.TOTAL = DALObj.TOTAL; data.TOTDIS = DALObj.TOTDIS; data.TOTVAT = DALObj.TOTVAT; data.VAT = DALObj.VAT; data.WAREHOUSE = DALObj.WAREHOUSE; data.INVCODE = DALObj.INVCODE; } return data; }
public ProductReserveData GetData(double loid) { ProductReserveData data = new ProductReserveData(); if (DALObj.GetDataByLOID(loid, null)) { data.LOID = DALObj.LOID; data.CODE = DALObj.CODE; data.ACTIVE = DALObj.ACTIVE; data.CADDRESS = DALObj.CADDRESS; data.CEMAIL = DALObj.CEMAIL; data.CFAX = DALObj.CFAX; data.CLASTNAME = DALObj.CLASTNAME; data.CNAME = DALObj.CNAME; data.CODE = DALObj.CODE; data.CREATEBY = DALObj.CREATEBY; data.CTEL = DALObj.CTEL; data.CTITLE = DALObj.CTITLE; data.CUSTOMER = DALObj.CUSTOMER; data.DUEDATE = DALObj.DUEDATE; data.GRANDTOT = DALObj.GRANDTOT; data.REMARK = DALObj.REMARK; data.REQDATE = DALObj.REQDATE; data.REQUISITIONTYPE = DALObj.REQUISITIONTYPE; data.STATUS = DALObj.STATUS; data.TOTAL = DALObj.TOTAL; data.TOTDIS = DALObj.TOTDIS; data.TOTVAT = DALObj.TOTVAT; data.VAT = DALObj.VAT; data.WAREHOUSE = DALObj.WAREHOUSE; data.INVCODE = DALObj.INVCODE; data.PAYMENTCONDITION = DALObj.PAYMENTCONDITION; data.CREDITDATE = DALObj.CREDITDATE; data.RESERVEDATE = DALObj.RESERVEDATE; data.CDELIVERY = DALObj.DELIVERYTYPE; data.OTHER = DALObj.OTHER; data.PAYMENT = DALObj.PAYMENT; data.CREDITCARDID = DALObj.CREDITCARDID; data.CREDITTYPE = DALObj.CREDITTYPE; data.BANK = DALObj.BANK; data.BANKBRANCH = DALObj.BANKBRANCH; data.CHEQUE = DALObj.CHEQUE; data.CHEQUEDATE = DALObj.CHEQUEDATE; data.REASON = DALObj.REASON; data.REFTYPELOID = DALObj.REFTYPELOID; data.REFNO = DALObj.REFNO; } return data; }
public bool NewRequisition(string userID, ProductReserveData data) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { DALObj.ACTIVE = data.ACTIVE; DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE; DALObj.STATUS = data.STATUS; DALObj.WAREHOUSE = data.WAREHOUSE; ret = DALObj.InsertCurrentData(userID, obj.zTrans); _LOID = DALObj.LOID; if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
public bool UpdateData(string userID, ProductReserveData data) { bool ret = true; if (ValidateData(data)) { OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { UpdateData(userID, data, obj.zTrans); obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } } else ret = false; return ret; }
public bool CommitData(string userID, ProductReserveData data) { bool ret = true; if (ValidateData(data)) { OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { UpdateData(userID, data, obj.zTrans); ret = DALObj.CutStockRequisition(_LOID, userID, obj.zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } } else ret = false; return ret; }
private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction zTrans) { bool ret = true; DALObj.GetDataByLOID(data.LOID, zTrans); DALObj.ACTIVE = data.ACTIVE; DALObj.CADDRESS = data.CADDRESS; DALObj.CEMAIL = data.CEMAIL; DALObj.CFAX = data.CFAX; DALObj.CLASTNAME = data.CLASTNAME; DALObj.CNAME = data.CNAME; // DALObj.CODE = data.CODE; DALObj.CTEL = data.CTEL; DALObj.CTITLE = data.CTITLE; DALObj.CUSTOMER = data.CUSTOMER; DALObj.DUEDATE = data.DUEDATE; DALObj.GRANDTOT = data.GRANDTOT; DALObj.REMARK = data.REMARK; DALObj.REQDATE = data.REQDATE; //DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE; DALObj.REFTYPELOID = data.REFTYPELOID; DALObj.REFTYPETABLE = data.REFTYPETABLE; DALObj.STATUS = data.STATUS; DALObj.TOTAL = data.TOTAL; DALObj.TOTDIS = data.TOTDIS; DALObj.TOTVAT = data.TOTVAT; DALObj.VAT = data.VAT; DALObj.WAREHOUSE = data.WAREHOUSE; DALObj.DELIVERYTYPE = data.CDELIVERY; DALObj.OTHER = data.OTHER; if (DALObj.INVCODE == "") DALObj.INVCODE = DALObj.GetInvCode(1, zTrans); DALObj.PAYMENTCONDITION = data.PAYMENTCONDITION; DALObj.CREDITDATE = data.CREDITDATE; DALObj.RESERVEDATE = data.RESERVEDATE; DALObj.OTHER = data.OTHER; DALObj.PAYMENT = data.PAYMENT; DALObj.CREDITCARDID = data.CREDITCARDID; DALObj.CREDITTYPE = data.CREDITTYPE; DALObj.BANK = data.BANK; DALObj.BANKBRANCH = data.BANKBRANCH; DALObj.CHEQUE = data.CHEQUE; DALObj.CHEQUEDATE = data.CHEQUEDATE; DALObj.REASON = data.REASON; DALObj.REFNO = data.REFNO; if (DALObj.OnDB) ret = DALObj.UpdateCurrentData(userID, zTrans); else DALObj.REQUISITIONTYPE = 11; ret = DALObj.InsertCurrentData(userID, zTrans); _LOID = DALObj.LOID; if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } RequisitionItemDAL itemDAL = new RequisitionItemDAL(); itemDAL.DeleteDataByRequisition(data.LOID, zTrans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { RequisitionItemData item = (RequisitionItemData)data.ITEM[i]; itemDAL.ACTIVE = item.ACTIVE; itemDAL.DISCOUNT = item.DISCOUNT; itemDAL.DUEDATE = item.DUEDATE; itemDAL.NETPRICE = item.NETPRICE; itemDAL.PRODUCT = item.PRODUCT; itemDAL.QTY = item.QTY; itemDAL.PRICE = item.PRICE; itemDAL.REQUISITION = DALObj.LOID; itemDAL.UNIT = item.UNIT; itemDAL.DUEDATE = data.DUEDATE; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); } }
public bool ValidateData(ProductReserveData data) { bool ret = true; if (data.CUSTOMER == 0) { ret = false; _error = "¡ÃسÒÃкØÅÙ¡¤éÒ"; } else if (data.DUEDATE.Year == 1) { ret = false; _error = "¡ÃسҡÓ˹´Çѹ·ÕèÊè§ÊÔ¹¤éÒ"; } //else if (data.CREDITDATE.Year == 1) //{ // ret = false; // _error = "¡ÃسҡÓ˹´Çѹ·Õè¤Ãº¡Ó˹´ªÓÃÐ"; //} else if (data.ITEM.Count == 0) { ret = false; _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ"; } return ret; }
private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction trans) { bool ret = true; if (ValidateData(data)) { if (SearchObj.GetDataByRefLOID(data.LOID, data.REFLOID, trans).Rows.Count > 0) throw new ApplicationException("äÁèÊÒÁÒö·ÓÃÒ¡ÒÃä´é à¹×èͧ¨Ò¡ãºàÊÃ稷ÕèàÅ×Í¡ ÍÂÙèÃÐËÇèÒ§´Óà¹Ô¹¡ÒÃŴ˹ÕéËÃ×ÍŴ˹ÕéàÊÃç¨ÊÔé¹áÅéÇ"); DALObj.OnDB = false; DALObj.GetDataByLOID(data.LOID, trans); DALObj.CODE = data.CODE; DALObj.ACTIVE = data.ACTIVE; DALObj.CADDRESS = data.CADDRESS; DALObj.CEMAIL = data.CEMAIL; DALObj.CFAX = data.CFAX; DALObj.CLASTNAME = data.CLASTNAME; DALObj.CNAME = data.CNAME; DALObj.CTEL = data.CTEL; DALObj.CTITLE = data.CTITLE; DALObj.CUSTOMER = data.CUSTOMER; DALObj.DUEDATE = data.DUEDATE; DALObj.GRANDTOT = data.GRANDTOT; DALObj.REASON = data.REASON; DALObj.REFLOID = data.REFLOID; DALObj.REFTABLE = data.REFTABLE; DALObj.REMARK = data.REMARK; DALObj.RESERVEDATE = data.RESERVEDATE; DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE; DALObj.STATUS = data.STATUS; DALObj.TOTAL = data.TOTAL; DALObj.TOTDIS = data.TOTDIS; DALObj.TOTVAT = data.TOTVAT; DALObj.VAT = data.VAT; DALObj.WAREHOUSE = data.WAREHOUSE; DALObj.REQDATE = data.REQDATE; DALObj.INVCODE = data.INVCODE; if (DALObj.OnDB) ret = DALObj.UpdateCurrentData(userID, trans); else ret = DALObj.InsertCurrentData(userID, trans); _LOID = DALObj.LOID; if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } RequisitionItemDAL itemDAL = new RequisitionItemDAL(); itemDAL.DeleteDataByRequisition(data.LOID, trans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { RequisitionItemData item = (RequisitionItemData)data.ITEM[i]; itemDAL.ACTIVE = item.ACTIVE; itemDAL.DISCOUNT = item.DISCOUNT; itemDAL.DUEDATE = item.DUEDATE; itemDAL.NETPRICE = item.NETPRICE; itemDAL.PRODUCT = item.PRODUCT; itemDAL.QTY = item.QTY; itemDAL.PRICE = item.PRICE; itemDAL.REQUISITION = DALObj.LOID; itemDAL.UNIT = item.UNIT; itemDAL.DUEDATE = data.DUEDATE; itemDAL.REFTABLE = item.REFTABLE; itemDAL.REFLOID = item.REFLOID; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, trans); if (!ret) throw new ApplicationException(itemDAL.ErrorMessage); } } else throw new ApplicationException(_error); }
private ProductReserveData GetOldData(double loid) { ProductReserveData data = new ProductReserveData(); if (DALObj.GetDataByLOID(loid, null)) { data.LOID = DALObj.LOID; data.ACTIVE = DALObj.ACTIVE; data.CADDRESS = DALObj.CADDRESS; data.CEMAIL = DALObj.CEMAIL; data.CFAX = DALObj.CFAX; data.CLASTNAME = DALObj.CLASTNAME; data.CNAME = DALObj.CNAME; data.CODE = ""; data.CREATEBY = DALObj.CREATEBY; data.CTEL = DALObj.CTEL; data.CTITLE = DALObj.CTITLE; data.CUSTOMER = DALObj.CUSTOMER; data.DUEDATE = DALObj.DUEDATE; data.GRANDTOT = DALObj.GRANDTOT; data.REASON = DALObj.REASON; data.REFLOID = DALObj.REFLOID; data.REFTABLE = DALObj.REFTABLE; data.REMARK = DALObj.REMARK; data.REQDATE = DALObj.REQDATE; data.RESERVEDATE = DALObj.RESERVEDATE; data.REQUISITIONTYPE = DALObj.REQUISITIONTYPE; data.STATUS = Constz.Requisition.Status.Waiting.Code; data.TOTAL = DALObj.TOTAL; data.TOTDIS = DALObj.TOTDIS; data.TOTVAT = DALObj.TOTVAT; data.VAT = DALObj.VAT; data.WAREHOUSE = DALObj.WAREHOUSE; } return data; }
private bool ValidateData(ProductReserveData data) { bool ret = true; if (data.REFLOID == 0) { ret = false; _error = "¡ÃسÒàÅ×Í¡ãºàÊÃç¨ÃѺà§Ô¹"; } else if (data.ITEM.Count == 0) { ret = false; _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ"; } return ret; }
private ProductReserveData GetData() { ProductReserveData data = new ProductReserveData(); data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text); data.REFNO = this.txtReference.Text.Trim(); data.ACTIVE = Constz.ActiveStatus.Active; data.CADDRESS = this.txtAddress.Text.Trim(); data.CODE = this.txtRefNo.Text.Trim(); data.CFAX = this.txtFax.Text.Trim(); data.CLASTNAME = this.txtLastName.Text.Trim(); data.CNAME = this.txtName.Text.Trim(); data.CTEL = this.txtTel.Text.Trim(); data.CTITLE = Convert.ToDouble(this.cmbTitle.SelectedItem.Value); data.PAYMENT = this.cmbCondition.SelectedValue; data.CUSTOMER = Convert.ToDouble(this.txtCustomer.Text == "" ? "0" : this.txtCustomer.Text); data.DUEDATE = this.ctlDueDate.DateValue; data.GRANDTOT = Convert.ToDouble(this.txtGrandTotal.Text == "" ? "0" : this.txtGrandTotal.Text); data.ITEM = ItemObj.GetItemList(); data.REMARK = this.txtRemark.Text.Trim(); data.REQDATE = this.ctlReqDate.DateValue; data.RESERVEDATE = this.ctlRecieveDate.DateValue; data.REFTYPELOID = Convert.ToDouble(this.cmbRefType.SelectedItem.Value); data.REFTYPETABLE = FlowObj.GetRefTypeTable(data.REFTYPELOID); data.STATUS = this.txtStatus.Text.Trim(); data.TOTAL = Convert.ToDouble(this.txtTotal.Text == "" ? "0" : this.txtTotal.Text); data.TOTDIS = Convert.ToDouble(this.txtTotalDiscount.Text == "" ? "0" : this.txtTotalDiscount.Text); data.TOTVAT = Convert.ToDouble(this.txtTotalVat.Text == "" ? "0" : this.txtTotalVat.Text); data.VAT = Convert.ToDouble(this.txtVat.Text == "" ? "0" : this.txtVat.Text); data.WAREHOUSE = Convert.ToDouble(this.txtWareHouse.Text == "" ? "0" : this.txtWareHouse.Text); data.CDELIVERY = this.cmbDelivery.SelectedValue; data.OTHER = this.txtOther.Text.Trim(); data.INVCODE = this.txtInvCode.Text.Trim(); data.CREDITDATE = this.ctlCreditDay.DateValue; data.PAYMENTCONDITION = (this.cmbCondition.SelectedItem.Value == "0" ? "" : this.cmbCondition.SelectedItem.Text); // data.REQUISITIONTYPE = Convert.ToDouble(this.cmbRequisitionType.SelectedItem.Value); if (this.rbtPayment1.Checked == true) { data.PAYMENT = Constz.Payment.Cash.Code; } if (this.rbtPayment2.Checked == true) { data.PAYMENT = Constz.Payment.CreditCard.Code; data.CREDITTYPE = Convert.ToDouble(this.cmbCreditType.SelectedValue); data.CREDITCARDID = this.txtCreditID.Text.Trim(); } if (this.rbtPayment3.Checked == true) { data.PAYMENT = Constz.Payment.Cheque.Code; data.CHEQUE = this.txtCheque.Text.Trim(); data.CHEQUEDATE = this.ctlChequeDate.DateValue; data.BANK = Convert.ToDouble(this.cmbBank.SelectedValue); data.BANKBRANCH = this.txtBranch.Text.Trim(); } if (this.rbtPayment4.Checked == true) { data.PAYMENT = Constz.Payment.Others.Code; data.REASON = this.txtReason.Text.Trim(); } return data; }
private void SetData(ProductReserveData data) { if (data.LOID == 0) { data.CREATEBY = Authz.CurrentUserInfo.UserID; data.WAREHOUSE = Authz.CurrentUserInfo.Warehouse; data.STATUS = Constz.Requisition.Status.Waiting.Code; data.VAT = Convert.ToDouble(SysConfigFlow.GetValue(Constz.ConfigName.VAT)); // data.RESERVEDATE = DateTime.Today; // this.cmbRequisitionType.Enabled = true; } //if (data.STATUS == Constz.Requisition.Status.Finish.Code) //{ // this.txtRefNo.ReadOnly = true; // this.txtRefNo.CssClass = "zTextbox-View"; // this.btnSearch.Visible = false; //} this.txtReference.Text = data.REFNO; this.txtLOID.Text = data.LOID.ToString(); this.txtStatus.Text = data.STATUS; this.txtStatusName.Text = Appz.GetStatusName(data.STATUS); this.txtCustomer.Text = data.CUSTOMER.ToString(); this.txtRequisitionType.Text = data.REQUISITIONTYPE.ToString(); this.cmbRefType.SelectedIndex = this.cmbRefType.Items.IndexOf(this.cmbRefType.Items.FindByValue(data.REFTYPELOID.ToString())); if (this.cmbRefType.SelectedValue == Constz.Requisition.RequisitionType.REQ01.ToString()) { this.txtRefNo.Text = data.CODE; this.txtCode.Text = data.CODE; } else { this.txtRefNo.Text = ""; this.txtCode.Text = ""; } this.txtCustomerCode.Text = ""; this.txtCustomerName.Text = ""; this.cmbTitle.SelectedIndex = this.cmbTitle.Items.IndexOf(this.cmbTitle.Items.FindByValue(data.CTITLE.ToString())); this.txtName.Text = data.CNAME; this.txtLastName.Text = data.CLASTNAME; this.txtAddress.Text = data.CADDRESS; this.txtTel.Text = data.CTEL; this.txtFax.Text = data.CFAX; this.ctlReqDate.DateValue = data.REQDATE.Year == 1 ? DateTime.Now : data.REQDATE; this.ctlRecieveDate.DateValue = data.RESERVEDATE; this.ctlSendDate.DateValue = data.RESERVEDATE.AddDays(14); this.txtCode.Text = this.txtRefNo.Text; this.ctlCreditDay.DateValue = data.CREDITDATE; this.txtInvCode.Text = data.INVCODE; this.cmbCondition.SelectedIndex = this.cmbCondition.Items.IndexOf(this.cmbCondition.Items.FindByText(data.PAYMENTCONDITION.ToString())); //this.txtCondition.Text = data.PAYMENTCONDITION; // this.txtRefNo.Text = data.CODE; // this.txtCode.Text = data.CODE; this.cmbDelivery.SelectedIndex = this.cmbDelivery.Items.IndexOf(this.cmbDelivery.Items.FindByValue(data.CDELIVERY.ToString())); //this.txtCondition.Text = data.PAYMENTCONDITION; //this.ctlCreditDay.DateValue = data.CREDITDATE; if (data.PAYMENT == Constz.Payment.Cash.Code) { this.rbtPayment1.Checked = true; } if (data.PAYMENT == Constz.Payment.CreditCard.Code) { this.rbtPayment2.Checked = true; this.cmbCreditType.SelectedIndex = this.cmbCreditType.Items.IndexOf(this.cmbCreditType.Items.FindByValue(data.CREDITTYPE.ToString())); this.cmbCreditType.Enabled = true; this.txtCreditID.Text = data.CREDITCARDID; this.txtCreditID.Enabled = true; } if (data.PAYMENT == Constz.Payment.Cheque.Code) { this.rbtPayment3.Checked = true; this.txtCheque.Text = data.CHEQUE; this.txtCheque.Enabled = true; this.ctlChequeDate.DateValue = data.CHEQUEDATE; this.ctlChequeDate.Enabled = true; this.cmbBank.SelectedIndex = this.cmbBank.Items.IndexOf(this.cmbBank.Items.FindByValue(data.BANK.ToString())); this.cmbBank.Enabled = true; this.txtBranch.Text = data.BANKBRANCH; this.txtBranch.Enabled = true; } if (data.PAYMENT == Constz.Payment.Others.Code) { this.rbtPayment4.Checked = true; this.txtReason.Text = data.REASON; this.txtReason.Enabled = true; } if (data.REQDATE.Year != 1) { double day = Convert.ToDouble(SysConfigFlow.GetValue(Constz.ConfigName.PERIOD)); } this.ctlDueDate.DateValue = data.DUEDATE; this.txtRemark.Text = data.REMARK; this.txtCreateBy.Text = data.CREATEBY; this.txtTotal.Text = data.TOTAL.ToString(Constz.DblFormat); this.txtTotalDiscount.Text = data.TOTDIS.ToString(Constz.DblFormat); this.txtVat.Text = data.VAT.ToString(); this.txtTotalVat.Text = data.TOTVAT.ToString(Constz.DblFormat); this.txtGrandTotal.Text = data.GRANDTOT.ToString(Constz.DblFormat); this.txtWareHouse.Text = data.WAREHOUSE.ToString(); this.txtNet.Text = data.GRANDTOT.ToString(Constz.IntFormat); SetCustomerData(data.CUSTOMER, false); this.txtOther.Text = data.OTHER; this.txtPopup.Text = FlowObj.GetUsedProduct(data.LOID); this.txtNewPopup.Text = ""; //this.txtNewPopup.Text = FlowObj.GetUsedProduct(data.LOID); SetGrvItem(data.STATUS); if (data.STATUS == Constz.Requisition.Status.Approved.Code || data.STATUS == Constz.Requisition.Status.Finish.Code || data.STATUS == Constz.Requisition.Status.Void.Code) { this.ctlToolbar.BtnSaveShow = false; this.ctlToolbar.BtnCancelShow = false; this.ctlToolbar.BtnSubmitShow = false; this.btnSearch.Visible = false; } //if (this.txtStatus.Text == Constz.Requisition.Status.Waiting.Code) //{ // CalculateDiscount(); //} if (data.STATUS == Constz.Requisition.Status.Reserve.Code) { this.btnSearch.Visible = false; } this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.InvoiceFull, data.LOID) + " return false;"; }
private void SetData(ProductReserveData data) { if (data.LOID != 0) this.cmbRequisitionType.Enabled = false; else this.cmbRequisitionType.Enabled = true; this.txtLOID.Text = data.LOID.ToString(); this.txtStatus.Text = data.STATUS; this.txtCustomer.Text = data.CUSTOMER.ToString(); this.cmbRequisitionType.SelectedIndex = this.cmbRequisitionType.Items.IndexOf(this.cmbRequisitionType.Items.FindByValue(data.REQUISITIONTYPE.ToString())); //print //this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductReserve, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + " return false;"; if(data.REQUISITIONTYPE.ToString() == Constz.Requisition.RequisitionType.REQ01.ToString()) this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductReserve, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + " return false;"; else if(data.REQUISITIONTYPE.ToString() == Constz.Requisition.RequisitionType.REQ02.ToString()) this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductReserveSale, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + " return false;"; else if(data.REQUISITIONTYPE.ToString() == Constz.Requisition.RequisitionType.REQ03.ToString()) this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductRequestInShop, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + " return false;"; else if(data.REQUISITIONTYPE.ToString() == Constz.Requisition.RequisitionType.REQ10.ToString()) this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductRequestInShop, Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text)) + " return false;"; this.txtCustomerCode.Text = ""; this.txtCustomerName.Text = ""; this.cmbTitle.SelectedIndex = this.cmbTitle.Items.IndexOf(this.cmbTitle.Items.FindByValue(data.CTITLE.ToString())); this.txtName.Text = data.CNAME; this.txtLastName.Text = data.CLASTNAME; this.txtAddress.Text = data.CADDRESS; this.txtTel.Text = data.CTEL; this.txtFax.Text = data.CFAX; this.txtRequisitionCode.Text = data.CODE; this.ctlReserveDate.DateValue = data.RESERVEDATE; if (data.RESERVEDATE.Year != 1) { double day = Convert.ToDouble(SysConfigFlow.GetValue(Constz.ConfigName.PERIOD)); this.ctlConfirmDate.DateValue = data.RESERVEDATE.AddDays(day); } this.ctlDueDate.DateValue = data.DUEDATE; this.txtRemark.Text = data.REMARK; this.txtCreateBy.Text = data.CREATEBY; this.txtStatusName.Text = Appz.GetStatusName(data.STATUS); this.txtTotal.Text = data.TOTAL.ToString(Constz.DblFormat); this.txtTotalDiscount.Text = data.TOTDIS.ToString(Constz.DblFormat); this.txtVat.Text = data.VAT.ToString(); this.txtTotalVat.Text = data.TOTVAT.ToString(Constz.DblFormat); this.txtGrandTotal.Text = data.GRANDTOT.ToString(Constz.DblFormat); this.txtWareHouse.Text = data.WAREHOUSE.ToString(); this.txtNet.Text = data.GRANDTOT.ToString(Constz.IntFormat); SetCustomerData(data.CUSTOMER, false); SetGrvItem(data.STATUS); if (data.STATUS != Constz.Requisition.Status.Waiting.Code) { this.txtCustomerCode.ReadOnly = true; this.txtCustomerCode.CssClass = "zTextbox-View"; this.btnSearch.Visible = false; this.txtDiscount.ReadOnly = true; this.txtDiscount.CssClass = "zTextboxR-View"; this.txtVat.ReadOnly = true; this.txtVat.CssClass = "zTextboxR-View"; this.ctlToolbar.BtnSaveShow = false; this.ctlToolbar.BtnCancelShow = false; this.ctlToolbar.BtnSubmitShow = false; this.ctlDueDate.Enabled = false; } this.grvItem.Columns[indexCHECk].Visible = (data.STATUS == Constz.Requisition.Status.Waiting.Code); this.ctlToolbarItem.Visible = (data.STATUS == Constz.Requisition.Status.Waiting.Code); }
private ProductReserveData GetData() { ProductReserveData data = new ProductReserveData(); data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text); data.ACTIVE = Constz.ActiveStatus.Active; data.CADDRESS = this.txtAddress.Text.Trim(); data.CFAX = this.txtFax.Text.Trim(); data.CLASTNAME = this.txtLastName.Text.Trim(); data.CNAME = this.txtName.Text.Trim(); data.CODE = this.txtRequisitionCode.Text.Trim(); data.CTEL = this.txtTel.Text.Trim(); data.CTITLE = Convert.ToDouble(this.cmbTitle.SelectedItem.Value); data.CUSTOMER = Convert.ToDouble(this.txtCustomer.Text == "" ? "0" : this.txtCustomer.Text); data.DUEDATE = this.ctlDueDate.DateValue; data.GRANDTOT = Convert.ToDouble(this.txtGrandTotal.Text == "" ? "0" : this.txtGrandTotal.Text); data.ITEM = ItemObj.GetItemList(); data.REMARK = this.txtRemark.Text.Trim(); data.REQDATE = DateTime.Now.Date; data.REQUISITIONTYPE = Constz.Requisition.RequisitionType.REQ12; data.STATUS = this.txtStatus.Text.Trim(); data.TOTAL = Convert.ToDouble(this.txtTotal.Text == "" ? "0" : this.txtTotal.Text); data.WAREHOUSE = Convert.ToDouble(this.txtWareHouse.Text == "" ? "0" : this.txtWareHouse.Text); return data; }
public bool SubmitReturnRequisition(string userID, ProductReserveData data) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { data.STATUS = Constz.Requisition.Status.Approved.Code; UpdateData(userID, data, obj.zTrans); ret = DALObj.CutStockRequisition(DALObj.LOID, userID, obj.zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
private void SetData(ProductReserveData data) { //if (data.LOID != 0) // this.cmbRequisitionType.Enabled = false; //else // this.cmbRequisitionType.Enabled = true; this.txtLOID.Text = data.LOID.ToString(); this.txtStatus.Text = data.STATUS; this.txtCustomer.Text = data.CUSTOMER.ToString(); this.txtCustomerCode.Text = ""; this.txtCustomerName.Text = ""; this.cmbTitle.SelectedIndex = this.cmbTitle.Items.IndexOf(this.cmbTitle.Items.FindByValue(data.CTITLE.ToString())); this.txtName.Text = data.CNAME; this.txtLastName.Text = data.CLASTNAME; this.txtAddress.Text = data.CADDRESS; this.txtTel.Text = data.CTEL; this.txtFax.Text = data.CFAX; this.txtRequisitionCode.Text = data.CODE; this.ctlReserveDate.DateValue = data.REQDATE; //if (data.REQDATE.Year != 1) //{ // double day = Convert.ToDouble(SysConfigFlow.GetValue(Constz.ConfigName.PERIOD)); // this.ctlReserveDate.DateValue = data.REQDATE.AddDays(day); //} this.ctlDueDate.DateValue = data.DUEDATE; this.txtRemark.Text = data.REMARK; this.txtCreateBy.Text = data.CREATEBY; this.txtStatusName.Text = (data.STATUS == Constz.Requisition.Status.ApproveWH.Code ? Constz.Requisition.Status.ApproveWH.Name : (data.STATUS == Constz.Requisition.Status.Void.Code ? Constz.Requisition.Status.Void.Name : (data.STATUS == Constz.Requisition.Status.Finish.Code ? Constz.Requisition.Status.Finish.Name : Constz.Requisition.Status.Waiting.Name))); this.txtTotal.Text = data.TOTAL.ToString(Constz.DblFormat); this.txtGrandTotal.Text = data.GRANDTOT.ToString(Constz.DblFormat); this.txtWareHouse.Text = data.WAREHOUSE.ToString(); SetCustomerData(data.CUSTOMER, false); SetGrvItem(data.STATUS); if (data.STATUS != Constz.Requisition.Status.Waiting.Code) { this.ctlToolbar.BtnSaveShow = false; this.ctlToolbar.BtnCancelShow = false; this.ctlToolbar.BtnSubmitShow = false; this.btnSearch.Visible = false; } this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.StockInReturnProduct, data.LOID) + " return false;"; }
private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction zTrans) { bool ret = true; if (ValidateData(data)) { DALObj.OnDB = false; DALObj.GetDataByLOID(data.LOID, zTrans); DALObj.ACTIVE = data.ACTIVE; DALObj.CADDRESS = data.CADDRESS; DALObj.CEMAIL = data.CEMAIL; DALObj.CFAX = data.CFAX; DALObj.CLASTNAME = data.CLASTNAME; DALObj.CNAME = data.CNAME; DALObj.CODE = data.CODE; DALObj.CTEL = data.CTEL; DALObj.CTITLE = data.CTITLE; DALObj.CUSTOMER = data.CUSTOMER; DALObj.DUEDATE = data.DUEDATE; DALObj.GRANDTOT = data.GRANDTOT; DALObj.REMARK = data.REMARK; DALObj.RESERVEDATE = data.RESERVEDATE; DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE; DALObj.STATUS = data.STATUS; DALObj.TOTAL = data.TOTAL; DALObj.TOTDIS = data.TOTDIS; DALObj.TOTVAT = data.TOTVAT; DALObj.VAT = data.VAT; DALObj.WAREHOUSE = data.WAREHOUSE; DALObj.REFTYPELOID = data.REQUISITIONTYPE; DALObj.REFTYPETABLE = "REQUISITIONTYPE"; if (DALObj.OnDB) ret = DALObj.UpdateCurrentData(userID, zTrans); else ret = DALObj.InsertCurrentData(userID, zTrans); _LOID = DALObj.LOID; if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } RequisitionItemDAL itemDAL = new RequisitionItemDAL(); itemDAL.DeleteDataByRequisition(data.LOID, zTrans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { RequisitionItemData item = (RequisitionItemData)data.ITEM[i]; itemDAL.ACTIVE = item.ACTIVE; itemDAL.DISCOUNT = item.DISCOUNT; itemDAL.DUEDATE = item.DUEDATE; itemDAL.NETPRICE = item.NETPRICE; itemDAL.PRODUCT = item.PRODUCT; itemDAL.QTY = item.QTY; itemDAL.PRICE = item.PRICE; itemDAL.REQUISITION = DALObj.LOID; itemDAL.UNIT = item.UNIT; itemDAL.DUEDATE = data.DUEDATE; itemDAL.ISVAT = item.ISVAT; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, zTrans); if (!ret) throw new ApplicationException(itemDAL.ErrorMessage); } } }