private void ClearControls() { txtHawb.Text = ""; CmbService.setValue(""); CmbPPD.SelectedItem.Value = ""; CmbSalesman.setValue(""); txtColoader.Text = ""; txtReference.Text = ""; txtClearance.Text = ""; txtDO.Text = ""; CmbReceipt.setValue(""); CmbFinalDest.setValue(""); chkInsurance.Checked = false; chkDG.Checked = false; chkSurrender.Checked = false; CmbShipperCode.setValue(""); //CmbShipperName.SelectedItem.Value = ""; CmbConsignee.setValue(""); //CmbConsigneeName.SelectedItem.Value = ""; CmbNotify1.setValue(""); //mbNotify1Name.SelectedItem.Value = ""; CmbNotify2.setValue(""); //CmbNotify2Name.SelectedItem.Value = ""; CmbCoLoader.setValue(""); //CmbCoLoaderName.SelectedItem.Value = ""; CmbBroker.setValue(""); //CmbBrokerName.SelectedItem.Value = ""; txtGWT.Text = ""; txtCWT.Text = ""; txtCBM.Text = ""; txtPiece.Text = ""; CmbUnit.setValue(""); txtContainer.Text = ""; CmbWarehouse.setValue(""); //CmbWarehouseName.SelectedItem.Value = ""; txtFreeStorageStart.Text = ""; txtFreeStorageEnd.Text = ""; txtPickUp.Text = ""; //CmbCompany.Text = ""; // CmbCompanyName.Text = ""; //CmbCurrency.Text = ""; txtRemark.Text = ""; }
// Save and Complete Sales private void btnSubmit_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Do you want to Complete Sale and Print? ", "Yes or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { if (lblTotal.Text == "0") { MessageBox.Show("Sorry ! you have not enough product \n Please Purchase product or Increase Product Quantity"); } //else if (Convert.ToInt32(txtinvoiceNo.Text) >= 53) //Please uncommet this section //{ // MessageBox.Show("Sorry ! Demo version has limited transaction \n Please buy it \n contact at : [email protected]", "Yes or No", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); //} else if (CmbWarehouse.Text == string.Empty) { MessageBox.Show("Please Select WareHouse .. "); CmbWarehouse.Focus(); } else { try { //Save payment info into 'sales_payment' table payment_item(); //Save Sales item into 'sales_item' table sales_item(); //Save Sale info into 'tbl_saleInfo' table SaleInfo(); // 5 % Rewards Point add to customer Account for total Payable amount // AddCredit(); // Inventory.InvoicePrint go = new Inventory.InvoicePrint(txtinvoiceNo.Text); View_Sales_invoice go = new View_Sales_invoice(txtinvoiceNo.Text); go.ShowDialog(); ShowSales_id_increment(); ClearForm2(); } catch (Exception exp) { MessageBox.Show(exp.Message); } } } }
private void Load() { latestTransNo = transactionNumber.Fetch(); foreach (var obj in (transaction.FetchAll())) { CmbTransactionNumbers.Add(obj.TransactionNumber); } CmbTransactionNumbers.Add(latestTransNo); CmbTransactionType.Add(new TransactionTypesModel()); foreach (var type in transactionType.FetchAll()) { CmbTransactionType.Add(type); } transactionDate = currentDate.ToString("MM/dd/yyyy"); CmbWarehouse.Add(new WareHouseModel()); foreach (var wh in warehouse.FetchAll()) { CmbWarehouse.Add(wh); } CmbLocation.Add(new LocationModel()); foreach (var loc in location.FetchAll()) { CmbLocation.Add(loc); } priceCategoryList.Add(""); priceCategoryList.Add("Selling Price"); priceCategoryList.Add("Purchase Price"); priceTypeList.Add(""); priceTypeList.Add("Current"); priceTypeList.Add("3 Months Ago"); priceTypeList.Add("6 Months Ago"); ReasonList = reason.FetchAll(); EnableDestination = false; }
private void DataBindList() { txtHawb.Focus(true); UserSheet1.seed = hidSeed.Text; List <IFields> Getlist = new List <IFields>(); Getlist.Add(dal.CreateIFields().Append("Option", "List") .Append("seed", hidSeed.Text) .Append("air_ToMAWB", hidMAWB.Text) .Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]) .Append("SYS", SYS) ); DataSet ds = GetDs("FW_AirImport_HAWB_SP", Getlist); if (ds != null && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["RowID"].ToString() != "") { txtHawb.Text = ds.Tables[0].Rows[0]["HAWB"].ToString(); txtReference.Text = ds.Tables[0].Rows[0]["Reference"].ToString(); txtClearance.Text = ds.Tables[0].Rows[0]["Clearance"].ToString(); chkInsurance.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["Insurance"].ToString() == "" ? 0 : ds.Tables[0].Rows[0]["Insurance"]); labMAWB.Text = ds.Tables[0].Rows[0]["MAWB"].ToString(); labLotNo.Text = ds.Tables[0].Rows[0]["LotNo"].ToString(); CmbReceipt.setValue(ds.Tables[0].Rows[0]["Receipt"].ToString()); CmbFinalDest.setValue(ds.Tables[0].Rows[0]["FinalDest"].ToString()); CmbSalesman.setValue(ds.Tables[0].Rows[0]["Salesman"].ToString()); chkDG.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["DG"].ToString() == "" ? 0 : ds.Tables[0].Rows[0]["DG"]); chkSurrender.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["Surrender"].ToString() == "" ? 0 : ds.Tables[0].Rows[0]["Surrender"]); CmbShipperCode.setValue(ds.Tables[0].Rows[0]["Shipper"].ToString()); CmbShipperCode.Text = ds.Tables[0].Rows[0]["ShipperName"].ToString(); CmbConsignee.setValue(ds.Tables[0].Rows[0]["Consignee"].ToString()); CmbConsignee.Text = ds.Tables[0].Rows[0]["ConsigneeName"].ToString(); CmbNotify1.setValue(ds.Tables[0].Rows[0]["Notify1"].ToString()); CmbNotify1.Text = ds.Tables[0].Rows[0]["Notify1Name"].ToString(); CmbNotify2.setValue(ds.Tables[0].Rows[0]["Notify2"].ToString()); CmbNotify2.Text = ds.Tables[0].Rows[0]["Notify2Name"].ToString(); CmbCoLoader.setValue(ds.Tables[0].Rows[0]["Coloader"].ToString()); CmbCoLoader.Text = ds.Tables[0].Rows[0]["ColoaderName"].ToString(); CmbBroker.setValue(ds.Tables[0].Rows[0]["Broker"].ToString()); CmbBroker.Text = ds.Tables[0].Rows[0]["BrokerName"].ToString(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["GWT"].ToString())) { txtGWT.Text = ds.Tables[0].Rows[0]["GWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["VWT"].ToString())) { txtVWT.Text = ds.Tables[0].Rows[0]["VWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CWT"].ToString())) { txtCWT.Text = ds.Tables[0].Rows[0]["CWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Piece"].ToString())) { txtPiece.Text = ds.Tables[0].Rows[0]["Piece"].ToString(); } CmbUnit.setValue(ds.Tables[0].Rows[0]["Unit"].ToString()); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Pallet"].ToString())) { txtPallet.Text = ds.Tables[0].Rows[0]["Pallet"].ToString(); } CmbWarehouse.setValue(ds.Tables[0].Rows[0]["Warehouse"].ToString()); CmbWarehouse.Text = ds.Tables[0].Rows[0]["WarehouseName"].ToString(); txtFreeStorageStart.Text = ds.Tables[0].Rows[0]["FreeStorageStart"].ToString(); txtFreeStorageEnd.Text = ds.Tables[0].Rows[0]["FreeStorageEnd"].ToString(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["FreeStorage"].ToString())) { NumFreeStorage.Text = ds.Tables[0].Rows[0]["FreeStorage"].ToString(); } txtPickUp.Text = ds.Tables[0].Rows[0]["PickUp"].ToString(); txtRemark.Text = ds.Tables[0].Rows[0]["Remark"].ToString(); if (Convert.ToBoolean(ds.Tables[0].Rows[0]["active"])) { img_void.Style.Add("display", "none"); } else { img_void.Style.Add("display", "inline"); btnSave.Disabled = true; btnCancel.Disabled = true; btnNext.Disabled = true; btnVoid.Text = "Active"; hidVoid.Text = "1"; } GridPanelInvoice.GetStore().DataSource = ds.Tables[1]; GridPanelInvoice.GetStore().DataBind(); GridPanelForeign.GetStore().DataSource = ds.Tables[3]; GridPanelForeign.GetStore().DataBind(); GridPanelRoute.GetStore().DataSource = ds.Tables[4]; GridPanelRoute.GetStore().DataBind(); GridPanelContact.GetStore().DataSource = ds.Tables[5]; GridPanelContact.GetStore().DataBind(); ControlBinder.pageTitleMsg(false, "AI-H:" + labLotNo.Text, "<p>Status : Edit HAWB of <span>" + labLotNo.Text + "</span></p>", div_bottom); } else { labMAWB.Text = ds.Tables[0].Rows[0]["MAWB"].ToString(); labLotNo.Text = ds.Tables[0].Rows[0]["LotNo"].ToString(); CmbReceipt.setValue(ds.Tables[0].Rows[0]["Receipt"].ToString()); CmbFinalDest.setValue(ds.Tables[0].Rows[0]["FinalDest"].ToString()); CmbShipperCode.setValue(ds.Tables[0].Rows[0]["Shipper"].ToString()); CmbConsignee.setValue(ds.Tables[0].Rows[0]["Consignee"].ToString()); CmbCoLoader.setValue(ds.Tables[0].Rows[0]["Coloader"].ToString()); CmbBroker.setValue(ds.Tables[0].Rows[0]["Broker"].ToString()); CmbSalesman.setValue(ds.Tables[0].Rows[0]["Salesman"].ToString()); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["GWT"].ToString())) { txtGWT.Text = ds.Tables[0].Rows[0]["GWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["VWT"].ToString())) { txtVWT.Text = ds.Tables[0].Rows[0]["VWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CWT"].ToString())) { txtCWT.Text = ds.Tables[0].Rows[0]["CWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Piece"].ToString())) { txtPiece.Text = ds.Tables[0].Rows[0]["Piece"].ToString(); } CmbUnit.setValue(ds.Tables[0].Rows[0]["Unit"].ToString()); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Pallet"].ToString())) { txtPallet.Text = ds.Tables[0].Rows[0]["Pallet"].ToString(); } ControlBinder.pageTitleMsg(false, "AI-H New", "<p>Status : New Blank Hawb </p>", div_bottom); } }
private void btnSave_Click(object sender, EventArgs e) { if (Validation() == true) { string ans = (MessageBox.Show("Do you want to Continue Save", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Information)).ToString(); if (ans == "Yes") { try { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = connection.CreateCommand(); SqlTransaction transaction; // Start a local transaction. transaction = connection.BeginTransaction("SampleTransaction"); // Must assign both transaction object and connection // to Command object for a pending local transaction try { for (int i = 0; i < Convert.ToInt32(dataGridView1.Rows.Count - 1); i++) { //command.Connection = connection; // command.Transaction = transaction; command = new SqlCommand("Rack_Save", connection, transaction); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@WH_ID", GID); command.Parameters.AddWithValue("@WareHouse_Name", CmbWarehouse.Text.TrimEnd().TrimStart()); command.Parameters.AddWithValue("@RackName", dataGridView1.Rows[i].Cells[0].Value.ToString()); command.Parameters.AddWithValue("@EnterBy", username); command.Parameters.AddWithValue("@Company", company); command.ExecuteNonQuery(); } // Attempt to commit the transaction. transaction.Commit(); MessageBox.Show("Saved Successfully...", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); } catch { // Attempt to roll back the transaction. try { transaction.Rollback(); MessageBox.Show("Save was unsuccessful...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Clear(); } catch (Exception ex2) { } } } } catch { } } dr.Close(); } else { CmbWarehouse.Focus(); } }
private void DataBindList() { CmbUnit.setValue("PKG"); List <IFields> Getlist = new List <IFields>(); Getlist.Add(dal.CreateIFields().Append("Option", "List") .Append("seed", hidSeed.Text) .Append("o_ToMBL", Request["MBL"]) .Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]) .Append("SYS", SYS) ); DataSet ds = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_OceanImport_HBL_SP", Getlist).GetList(); if (ds != null && ds.Tables[0].Rows.Count > 0) { txtHawb.Text = ds.Tables[0].Rows[0]["HBL"].ToString(); CmbService.setValue(ds.Tables[0].Rows[0]["ServiceMode"]); CmbPPD.SelectedItem.Value = ds.Tables[0].Rows[0]["PPD"].ToString(); CmbSalesman.setValue(ds.Tables[0].Rows[0]["Salesman"]); labImpLotNo.Text = ds.Tables[0].Rows[0]["LotNo"].ToString(); txtColoader.Text = ds.Tables[0].Rows[0]["ColoaderHBL"].ToString(); txtReference.Text = ds.Tables[0].Rows[0]["Reference"].ToString(); txtClearance.Text = ds.Tables[0].Rows[0]["Clearance"].ToString(); txtDO.Text = ds.Tables[0].Rows[0]["DO"].ToString(); labMBL.Text = ds.Tables[0].Rows[0]["MBL"].ToString(); CmbReceipt.setValue(ds.Tables[0].Rows[0]["Receipt"]); CmbFinalDest.setValue(ds.Tables[0].Rows[0]["FinalDest"].ToString()); chkInsurance.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["Insurance"]); chkDG.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["DG"]); chkSurrender.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["Surrender"]); CmbShipperCode.setValue(ds.Tables[0].Rows[0]["Shipper"].ToString()); CmbShipperCode.Text = ds.Tables[0].Rows[0]["ShipperName"].ToString(); CmbConsignee.setValue(ds.Tables[0].Rows[0]["Consignee"].ToString()); CmbConsignee.Text = ds.Tables[0].Rows[0]["ConsigneeName"].ToString(); CmbNotify1.setValue(ds.Tables[0].Rows[0]["Notify1"].ToString()); CmbNotify1.Text = ds.Tables[0].Rows[0]["Notify1Name"].ToString(); CmbNotify2.setValue(ds.Tables[0].Rows[0]["Notify2"].ToString()); CmbNotify2.Text = ds.Tables[0].Rows[0]["Notify2Name"].ToString(); CmbCoLoader.setValue(ds.Tables[0].Rows[0]["Coloader"].ToString()); CmbCoLoader.Text = ds.Tables[0].Rows[0]["ColoaderName"].ToString(); CmbBroker.setValue(ds.Tables[0].Rows[0]["Broker"].ToString()); CmbBroker.Text = ds.Tables[0].Rows[0]["BrokerName"].ToString(); //if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["GWT"].ToString())) // txtGWT.Text = ds.Tables[0].Rows[0]["GWT"].ToString(); //if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CWT"].ToString())) // txtCWT.Text = ds.Tables[0].Rows[0]["CWT"].ToString(); //if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CBM"].ToString())) // txtCBM.Text = ds.Tables[0].Rows[0]["CBM"].ToString(); //if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Piece"].ToString())) // txtPiece.Text = ds.Tables[0].Rows[0]["Piece"].ToString(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["GWT"].ToString())) { txtGWT.Text = ds.Tables[0].Rows[0]["GWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["AWT"].ToString())) { txtAGWT.Text = ds.Tables[0].Rows[0]["AWT"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CBM"].ToString())) { txtCBM.Text = ds.Tables[0].Rows[0]["CBM"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["ACBM"].ToString())) { txtACBM.Text = ds.Tables[0].Rows[0]["ACBM"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["PKGS"].ToString())) { txtPiece.Text = ds.Tables[0].Rows[0]["PKGS"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["APKGS"].ToString())) { txtAPiece.Text = ds.Tables[0].Rows[0]["APKGS"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["WM"].ToString())) { txtCWT.Text = ds.Tables[0].Rows[0]["WM"].ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["AWM"].ToString())) { txtAWM.Text = ds.Tables[0].Rows[0]["AWM"].ToString(); } CmbUnit.setValue(ds.Tables[0].Rows[0]["Unit"].ToString()); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Container"].ToString())) { txtContainer.Text = ds.Tables[0].Rows[0]["Container"].ToString(); } CmbWarehouse.setValue(ds.Tables[0].Rows[0]["Warehouse"].ToString()); CmbWarehouse.Text = ds.Tables[0].Rows[0]["WarehouseName"].ToString(); txtFreeStorageStart.Text = ds.Tables[0].Rows[0]["FreeStorageStart"].ToString(); txtFreeStorageEnd.Text = ds.Tables[0].Rows[0]["FreeStorageEnd"].ToString(); txtPickUp.Text = ds.Tables[0].Rows[0]["PickUp"].ToString(); txtRemark.Text = ds.Tables[0].Rows[0]["Remark"].ToString(); GridPanelInvoice.GetStore().DataSource = ds.Tables[1]; GridPanelInvoice.GetStore().DataBind(); GridPanelContainer.GetStore().DataSource = ds.Tables[2]; GridPanelContainer.GetStore().DataBind(); if (ds.Tables[2].Rows.Count > 0) { double GWT = 0.000, Pieces = 0, CBM = 0.000, wm = 0.000; for (int i = 0; i < ds.Tables[2].Rows.Count; i++) { GWT += Convert.ToDouble(ds.Tables[2].Rows[i]["GWT"].ToString() == "" ? "0.000" : ds.Tables[2].Rows[i]["GWT"].ToString()); Pieces += Convert.ToDouble(ds.Tables[2].Rows[i]["PKGS"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["PKGS"].ToString()); CBM += Convert.ToDouble(ds.Tables[2].Rows[i]["CBM"].ToString() == "" ? "0.000" : ds.Tables[2].Rows[i]["CBM"].ToString()); wm += Convert.ToDouble(ds.Tables[2].Rows[i]["WM"].ToString() == "" ? "0.000" : ds.Tables[2].Rows[i]["WM"].ToString()); } if (Pieces.ToString() != "0") { txtAPiece.Text = Pieces.ToString(); } if (GWT.ToString() != "0") { txtAGWT.Text = GWT.ToString(); } if (CBM.ToString() != "0") { txtACBM.Text = CBM.ToString(); } if (wm.ToString() != "0") { txtAWM.Text = wm.ToString(); } } if (Convert.ToBoolean(ds.Tables[0].Rows[0]["active"])) { img_void.Style.Value = "display:none"; } else { img_void.Style.Value = "display:inline"; btnSave.Disabled = true; btnCancel.Disabled = true; btnNext.Disabled = true; btnVoid.Text = "Active"; hidVoid.Text = "1"; X.AddScript("$('#showContainer').hide();"); } GridPanelOther.GetStore().DataSource = ds.Tables[3]; GridPanelOther.GetStore().DataBind(); GridPanelForeign.GetStore().DataSource = ds.Tables[5]; GridPanelForeign.GetStore().DataBind(); GridPanelRoute.GetStore().DataSource = ds.Tables[6]; GridPanelRoute.GetStore().DataBind(); GridPanelContact.GetStore().DataSource = ds.Tables[7]; GridPanelContact.GetStore().DataBind(); } if (!string.IsNullOrEmpty(Request["seed"])) { ControlBinder.pageTitleMsg(false, "OI-H:" + labImpLotNo.Text, "<p>Status : Edit HBL of <span>" + labImpLotNo.Text + "</span>. </p>", div_bottom); } else { ControlBinder.pageTitleMsg(false, "OI-H New", "<p>Status : New Blank HBL . </p>", div_bottom); } txtHawb.Focus(true); }