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();
        }
Example #2
0
		private void LoadItemData()
		{	
			ProductPackage clsProductPackage = new ProductPackage(); 

			try
			{
				DataClass clsData = new DataClass(); 
				System.Data.DataTable dt = clsData.DataReaderToDataTable(clsProductPackage.List(mDetails.ProductID,"ProductDesc",SortOption.Ascending));
				clsProductPackage.CommitAndDispose();
				
				//dt.TableName = "tblProductPackage";
                this.dgStyle.MappingName = dt.TableName;
				dgItems.DataSource = dt;
				dgItems.Select(0);
				dgItems.CurrentRowIndex=0;
			}
			catch (Exception ex)
			{
				clsProductPackage.CommitAndDispose();
				MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); 
			}
		}
		private void LoadItemData()
		{	
			try
			{
				DataClass clsData = new DataClass(); 
                ProductPackage clsProductPackage = new ProductPackage();
                System.Data.DataTable dt = clsData.DataReaderToDataTable(clsProductPackage.List(mDetails.ProductID, "ProductDesc", SortOption.Ascending));
                clsProductPackage.CommitAndDispose();

                lstItems.Items.Clear(); int iImgCtr = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (mboIsPriceInq)
                        lstItems.Items.Add(dr["PackageID"].ToString(), "[" + dr["Price"].ToString() + "]" + Environment.NewLine + dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["ProductDesc"].ToString(), iImgCtr);
                    else
                        lstItems.Items.Add(dr["PackageID"].ToString(), dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["ProductDesc"].ToString(), iImgCtr);
                    if (iImgCtr == 7) iImgCtr = 0; else iImgCtr++;
                }
                try { lstItems.Items[0].Selected = true; }
                catch { }

			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); 
			}
		}
Example #4
0
        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");

            ComputeItemAmount();
            lstItemFixCssClass();
        }
Example #5
0
        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");
        }
Example #6
0
		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;
		}
Example #7
0
		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;
		}
Example #8
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;
            }
		}
Example #9
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();
		}
Example #10
0
        protected void lstProductPackages_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            TextBox txtSellingPrice = (TextBox)e.Item.FindControl("txtSellingPrice");
            TextBox txtBarCode1 = (TextBox)e.Item.FindControl("txtBarCode1");
            TextBox txtBarCode2 = (TextBox)e.Item.FindControl("txtBarCode2");
            TextBox txtBarCode3 = (TextBox)e.Item.FindControl("txtBarCode3");

            switch (e.CommandName)
            {
                case "cmdDelProductPackage":
                    Label lblProductPackageID = (Label)e.Item.FindControl("lblProductPackageID");

                    ProductPackage clsProductPackage = new ProductPackage();
                    clsProductPackage.Delete(lblProductPackageID.Text);
                    clsProductPackage.CommitAndDispose();

                    cboProductCode_SelectedIndexChanged(null, null);
                    break;
                case "cmdPrintShelvesBarCode1":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter1 = new ThermalBarCodePrinter();
                    clsThermalBarCodePrinter1.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode1.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;
                case "cmdPrintShelvesBarCode2":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter2 = new ThermalBarCodePrinter();
                    clsThermalBarCodePrinter2.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode2.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;
                case "cmdPrintShelvesBarCode3":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter3 = new ThermalBarCodePrinter();
                    clsThermalBarCodePrinter3.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode3.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;
                case "cmdPrintTagPriceBarCode1":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice1 = new ThermalBarCodePrinter();
                    clsThermalBarCodeTagPrice1.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode1.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;
                case "cmdPrintTagPriceBarCode2":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice2 = new ThermalBarCodePrinter();
                    clsThermalBarCodeTagPrice2.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode2.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;
                case "cmdPrintTagPriceBarCode3":
                    AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice3 = new ThermalBarCodePrinter();
                    clsThermalBarCodeTagPrice3.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode3.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0"));
                    break;

                // 02Mar2015 : Added to automatically generate Barcode
                case "imgCreateBarCode1_Click":
                    txtBarCode1.Text = CreateBarCode();
                    break;
                case "imgCreateBarCode2_Click":
                    txtBarCode2.Text = CreateBarCode();
                    break;
                case "imgCreateBarCode3_Click":
                    txtBarCode3.Text = CreateBarCode();
                    break;
            }
        }
Example #11
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				ProductPackage clsProductPackage = new ProductPackage();
				clsProductPackage.Delete(stIDs.Substring(0,stIDs.Length-1));
				clsProductPackage.CommitAndDispose();

				Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();

				clsAuditDetails.ActivityDate = DateTime.Now;
				clsAuditDetails.User = Convert.ToString(Session["Name"]);
				clsAuditDetails.IPAddress = Request.UserHostAddress;
				clsAuditDetails.Activity = "Product Package";
				clsAuditDetails.Remarks = "Delete Product Package(s). ProductID:'" + lblProductID.Text + "' IDs:'" + stIDs + "'";

				Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
				clsAuditTrail.Insert(clsAuditDetails);
				clsAuditTrail.CommitAndDispose();
			}

			return boRetValue;
		}
Example #12
0
		private void LoadList()
		{	
			string SortField = "PackageID";
			if (Request.QueryString["sortfield"]!=null)
			{	SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);	}

            SortOption SortOrder = SortOption.Ascending;
			if (Request.QueryString["sortoption"]!=null)
            { SortOrder = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); }

            ProductPackage clsProductPackage = new ProductPackage();
            System.Data.DataTable dt = clsProductPackage.ListAsDataTable(Convert.ToInt64(lblProductID.Text), SortField: SortField, SortOrder: SortOrder);
			clsProductPackage.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;

			int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
			
			PageData.AllowPaging = true;
			PageData.PageSize = iPageSize;
			try
			{
				PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;				
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}
			catch
			{
				PageData.CurrentPageIndex = 1;
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}			
			
			cboCurrentPage.Items.Clear();
			for (int i=0; i < PageData.PageCount;i++)
			{
				int iValue = i + 1;
				cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
				if (PageData.CurrentPageIndex == i)
				{	cboCurrentPage.Items[i].Selected = true;}
				else
				{	cboCurrentPage.Items[i].Selected = false;}
			}
			lblDataCount.Text = " of " + " " + PageData.PageCount;
		}