private bool SaveRecord() { long lngUID = long.Parse(Session["UID"].ToString()); DateTime dteChangeDate = DateTime.Now; ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = new ProductPackageDetails(); clsDetails.PackageID = Convert.ToInt64(lblPackageID.Text); clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value); clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.Price1 = Convert.ToDecimal(txtPrice1.Text); clsDetails.Price2 = Convert.ToDecimal(txtPrice2.Text); clsDetails.Price3 = Convert.ToDecimal(txtPrice3.Text); clsDetails.Price4 = Convert.ToDecimal(txtPrice4.Text); clsDetails.Price5 = Convert.ToDecimal(txtPrice5.Text); clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text); clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); clsDetails.BarCode1 = txtBarCode1.Text; clsDetails.BarCode2 = txtBarCode2.Text; clsDetails.BarCode3 = txtBarCode3.Text; clsProductPackage.Update(clsDetails, lngUID, dteChangeDate, "Product Package Update."); clsProductPackage.CommitAndDispose(); return(true); }
private void SelectItem() { ListView.SelectedListViewItemCollection items = this.lstItems.SelectedItems; foreach (ListViewItem item in items) { mDetails.ProductPackageID = Convert.ToInt64(item.SubItems[0].Name); break; } ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = clsProductPackage.Details(mDetails.ProductPackageID); clsProductPackage.CommitAndDispose(); if (mDetails.ProductPackageID != 0) { mDetails.ProductUnitID = clsDetails.UnitID; mDetails.ProductUnitCode = clsDetails.UnitCode; mDetails.Price = clsDetails.Price; mDetails.PackageQuantity = clsDetails.Quantity; mDetails.VAT = clsDetails.VAT; mDetails.LocalTax = clsDetails.LocalTax; mDetails.Amount = (mDetails.Quantity * mDetails.Price) - (mDetails.Quantity * mDetails.Discount); mDetails.PurchasePrice = clsDetails.PurchasePrice; mDetails.Amount = mDetails.Quantity * mDetails.PurchasePrice; } dialog = DialogResult.OK; this.Hide(); }
private bool SaveRecord() { ProductPackageDetails clsDetails = new ProductPackageDetails(); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value); clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.Price1 = Convert.ToDecimal(txtPrice1.Text); clsDetails.Price2 = Convert.ToDecimal(txtPrice2.Text); clsDetails.Price3 = Convert.ToDecimal(txtPrice3.Text); clsDetails.Price4 = Convert.ToDecimal(txtPrice4.Text); clsDetails.Price5 = Convert.ToDecimal(txtPrice5.Text); clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text); clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); clsDetails.BarCode1 = txtBarCode1.Text; clsDetails.BarCode2 = txtBarCode2.Text; clsDetails.BarCode3 = txtBarCode3.Text; ProductPackage clsProductPackage = new ProductPackage(); clsProductPackage.Insert(clsDetails); clsProductPackage.CommitAndDispose(); return(true); }
protected void cboProductUnit_SelectedIndexChanged(object sender, EventArgs e) { ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = clsProductPackage.DetailsByProductIDAndUnitID(long.Parse(cboProductCode.SelectedValue), long.Parse(cboProductUnit.SelectedValue)); if (clsDetails.PackageID == 0) { ProductUnit clsProductUnit = new ProductUnit(clsProductPackage.Connection, clsProductPackage.Transaction); Products clsProduct = new Products(clsProductPackage.Connection, clsProductPackage.Transaction); ProductDetails clsProductDetails = clsProduct.Details(long.Parse(cboProductCode.SelectedItem.Value)); decimal decBaseUnitValue = clsProductUnit.GetBaseUnitValue(long.Parse(cboProductCode.SelectedItem.Value), int.Parse(cboProductUnit.SelectedItem.Value), 1); clsDetails.Price = decBaseUnitValue * clsProductDetails.Price; clsDetails.PurchasePrice = decBaseUnitValue * clsProductDetails.PurchasePrice; } clsProductPackage.CommitAndDispose(); txtPrice.Text = clsDetails.PurchasePrice.ToString("#####0.#0"); txtSellingPrice.Text = clsDetails.Price.ToString("#####0.#0"); txtOldSellingPrice.Text = clsDetails.Price.ToString("#####0.#0"); decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice; try { decMargin = decMargin / clsDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtMargin.Text = decMargin.ToString("#,##0.##0"); txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); }
private void LoadRecord() { ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = clsProductPackage.Details(Convert.ToInt64(lblPackageID.Text)); Products clsProduct = new Products(clsProductPackage.Connection, clsProductPackage.Transaction); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); ProductBaseVariationsMatrixDetails clsProductBaseVariationsMatrixDetails = new ProductBaseVariationsMatrix(clsProductPackage.Connection, clsProductPackage.Transaction).BaseDetails(clsDetails.MatrixID, clsDetails.ProductID); clsProductPackage.CommitAndDispose(); lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString(); lblMatrixID.Text = clsDetails.MatrixID.ToString(); lblMatrixDescription.Text = clsDetails.MatrixID == 0 ? "" : "Base Matrix: " + clsProductBaseVariationsMatrixDetails.Description; cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsDetails.UnitID.ToString())); txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0"); txtPrice1.Text = clsDetails.Price1.ToString("#,##0.#0"); txtPrice2.Text = clsDetails.Price2.ToString("#,##0.#0"); txtPrice3.Text = clsDetails.Price3.ToString("#,##0.#0"); txtPrice4.Text = clsDetails.Price4.ToString("#,##0.#0"); txtPrice5.Text = clsDetails.Price5.ToString("#,##0.#0"); txtWSPrice.Text = clsDetails.WSPrice.ToString("#,##0.#0"); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0"); decimal decMargin = clsDetails.Price - clsDetails.PurchasePrice; try { decMargin = decMargin / clsDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtMargin.Text = decMargin.ToString("#,##0.##0"); decMargin = clsDetails.WSPrice - clsDetails.PurchasePrice; try { decMargin = decMargin / clsDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0"); txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); txtQuantity.Text = clsDetails.Quantity.ToString("#,##0.#0"); txtBarCode1.Text = clsDetails.BarCode1; txtBarCode2.Text = clsDetails.BarCode2; txtBarCode3.Text = clsDetails.BarCode3; if (clsDetails.Quantity == 1 && clsProductDetails.BaseUnitID == clsDetails.UnitID) { txtQuantity.Enabled = false; cboUnit.Enabled = false; } }
private Int32 SaveRecord() { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails(); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text); clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text); clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text); int id = clsUnitMatrix.Insert(clsDetails); ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails(); ProductPackage clsProductPackage = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value)); if (clsProductPackageDetails.PackageID == 0) { Products clsProduct = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); Terminal clsTerminal = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString()); clsProductPackageDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsProductPackageDetails.UnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsProductPackageDetails.Price = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.WSPrice = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.Quantity = 1; clsProductPackageDetails.VAT = clsTerminalDetails.VAT; clsProductPackageDetails.EVAT = clsTerminalDetails.EVAT; clsProductPackageDetails.LocalTax = clsTerminalDetails.LocalTax; if (!string.IsNullOrEmpty(clsProductDetails.BarCode1)) { clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } if (!string.IsNullOrEmpty(clsProductDetails.BarCode2)) { clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } if (!string.IsNullOrEmpty(clsProductDetails.BarCode3)) { clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } clsProductPackage.Insert(clsProductPackageDetails); } clsUnitMatrix.CommitAndDispose(); return(id); }
protected void cboProductUnit_SelectedIndexChanged(object sender, EventArgs e) { ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = clsProductPackage.DetailsByProductIDAndUnitID(long.Parse(cboProductCode.SelectedValue), long.Parse(cboProductUnit.SelectedValue)); if (clsDetails.PackageID == 0) { ProductUnit clsProductUnit = new ProductUnit(clsProductPackage.Connection, clsProductPackage.Transaction); Products clsProduct = new Products(clsProductPackage.Connection, clsProductPackage.Transaction); ProductDetails clsProductDetails = clsProduct.Details(long.Parse(cboProductCode.SelectedItem.Value)); decimal decBaseUnitValue = clsProductUnit.GetBaseUnitValue(long.Parse(cboProductCode.SelectedItem.Value), int.Parse(cboProductUnit.SelectedItem.Value), 1); clsDetails.Price = decBaseUnitValue * clsProductDetails.Price; clsDetails.PurchasePrice = decBaseUnitValue * clsProductDetails.PurchasePrice; } clsProductPackage.CommitAndDispose(); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#####0.##0"); }
private void SaveRecord() { long lngUID = long.Parse(Session["UID"].ToString()); DateTime dteChangeDate = DateTime.Now; ProductPackage clsProductPackage = new ProductPackage(); clsProductPackage.GetConnection(); bool boIsFirstRecord = true; ProductPackageDetails clsProductPackageDetails; foreach (DataListItem e in lstProductPackages.Items) { if (boIsFirstRecord == true) { TextBox txtCommision = (TextBox)e.FindControl("txtCommision"); Products clsProduct = new Products(clsProductPackage.Connection, clsProductPackage.Transaction); clsProduct.UpdateCommision(long.Parse(cboProductCode.SelectedValue), Convert.ToDecimal(txtCommision.Text)); boIsFirstRecord = false; } HtmlInputCheckBox chkProductPackageID = (HtmlInputCheckBox)e.FindControl("chkProductPackageID"); TextBox txtBarCode1 = (TextBox)e.FindControl("txtBarCode1"); TextBox txtBarCode2 = (TextBox)e.FindControl("txtBarCode2"); TextBox txtBarCode3 = (TextBox)e.FindControl("txtBarCode3"); Label lblUnitName = (Label)e.FindControl("lblUnitName"); TextBox txtQuantity = (TextBox)e.FindControl("txtQuantity"); TextBox txtPurchasePrice = (TextBox)e.FindControl("txtPurchasePrice"); TextBox txtSellingPrice = (TextBox)e.FindControl("txtSellingPrice"); TextBox txtPrice1 = (TextBox)e.FindControl("txtPrice1"); TextBox txtPrice2 = (TextBox)e.FindControl("txtPrice2"); TextBox txtPrice3 = (TextBox)e.FindControl("txtPrice3"); TextBox txtPrice4 = (TextBox)e.FindControl("txtPrice4"); TextBox txtPrice5 = (TextBox)e.FindControl("txtPrice5"); TextBox txtWSPrice = (TextBox)e.FindControl("txtWSPrice"); Label lblVAT = (Label)e.FindControl("lblVAT"); Label lblEVAT = (Label)e.FindControl("lblEVAT"); Label lblLocalTax = (Label)e.FindControl("lblLocalTax"); clsProductPackageDetails = new ProductPackageDetails(); clsProductPackageDetails.PackageID = Convert.ToInt64(chkProductPackageID.Value); clsProductPackageDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedValue); clsProductPackageDetails.UnitID = Convert.ToInt32(lblUnitName.ToolTip); clsProductPackageDetails.Price = Convert.ToDecimal(txtSellingPrice.Text); clsProductPackageDetails.Price1 = Convert.ToDecimal(txtPrice1.Text); clsProductPackageDetails.Price2 = Convert.ToDecimal(txtPrice2.Text); clsProductPackageDetails.Price3 = Convert.ToDecimal(txtPrice3.Text); clsProductPackageDetails.Price4 = Convert.ToDecimal(txtPrice4.Text); clsProductPackageDetails.Price5 = Convert.ToDecimal(txtPrice5.Text); clsProductPackageDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); clsProductPackageDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsProductPackageDetails.Quantity = Convert.ToDecimal(txtQuantity.Text); clsProductPackageDetails.VAT = Convert.ToDecimal(lblVAT.Text); clsProductPackageDetails.EVAT = Convert.ToDecimal(lblEVAT.Text); clsProductPackageDetails.LocalTax = Convert.ToDecimal(lblLocalTax.Text); clsProductPackageDetails.BarCode1 = txtBarCode1.Text; clsProductPackageDetails.BarCode2 = txtBarCode2.Text; clsProductPackageDetails.BarCode3 = txtBarCode3.Text; clsProductPackage.Update(clsProductPackageDetails, lngUID, dteChangeDate, "Change price adjustment."); } clsProductPackage.CommitAndDispose(); }