コード例 #1
0
        internal void UpdateSKUItemList(int index, ItemPricing _itemsku)
        {
            if (ItemPriceList.Count == 0 || ItemPriceList.Count <= index)
                ItemPriceList.Add(_itemsku);
            else
                ItemPriceList[index] = _itemsku;

            var _row = dgvProdDetails.Rows[index];
            _row.Cells["ColProduct"].Value = _itemsku.Item.Name;
            _row.Cells["ColPurchaseValue"].Value = _itemsku.PurchaseValue.ToString("#.##");

            var wROff = (_itemsku.Wholesale - (((_itemsku.WholesaleMargin * _itemsku.PurchaseValue) / 100) + _itemsku.PurchaseValue));
            //_row.Cells["colWSaleROff"].Value = (wROff == 0 ? "0" : wROff.ToString("#.##"));
            _row.Cells["ColWholesaleValue"].Value = _itemsku.Wholesale.ToString("#.##");

            var rROff = (_itemsku.Retail - (((_itemsku.RetailMargin * _itemsku.Wholesale) / 100) + _itemsku.Wholesale));
            _row.Cells["ColResaleVal"].Value = _itemsku.Retail.ToString("#.##");
            //_row.Cells["colRSaleROff"].Value = (rROff == 0 ? "0" : rROff.ToString("#.##"));

            _row.Cells["colItemUnit"].Value = _itemsku.Item.QuantityUnit;
            _row.Cells["colVatPercent"].Value = _itemsku.VATPercent;
            _row.Cells["colVat"].Value = _itemsku.VAT;

            if (_itemsku.Package != null)
                _row.Cells["ColPackageType"].Value = _itemsku.Package.Name;
            _row.Cells["ColPackQuantity"].Value = _itemsku.PackageQuantity;
            _row.Cells["colItemPerPack"].Value = _itemsku.QuantityPerPack;

            _itemsku.TotalPurchaseValue = (_itemsku.PackageQuantity * (_itemsku.QuantityPerPack * _itemsku.PurchaseValue));
            _itemsku.TotalWholesaleValue = (_itemsku.PackageQuantity * (_itemsku.QuantityPerPack * _itemsku.Wholesale));
            _itemsku.TotalResaleValue = (_itemsku.PackageQuantity * (_itemsku.QuantityPerPack * _itemsku.Retail));

            _row.Cells["colTotalBasic"].Value = (_itemsku.Basic * _itemsku.PackageQuantity * _itemsku.QuantityPerPack).ToString("#.##");
            _row.Cells["ColTotPurchaseVal"].Value = _itemsku.TotalPurchaseValue.ToString("#.##");
            _row.Cells["ColTotWholesaleVal"].Value = _itemsku.TotalWholesaleValue.ToString("#.##");
            _row.Cells["ColTotResaleVal"].Value = _itemsku.TotalResaleValue.ToString("#.##");

            CalculatePaymentDetails();

            dgvProdDetails.NotifyCurrentCellDirty(true);
            dgvProdDetails.NotifyCurrentCellDirty(false);
        }
コード例 #2
0
        public Winform_ItemSKUDetails(int index, int revisionID, ItemPricing itemsku = null)
        {
            InitializeComponent();
            this.Index = index;

            this.revisionID = revisionID;

            //set combobox is set to default.
            if (revisionID != 0)
            {
                cmbVATPercent.DataSource = Builders.VATRevisionBuilder.GetVATRevisionPercentageList(revisionID);
                //cmbVATPercent.DisplayMember = "Percent";
            }

            cmbPackType.DataSource = Builders.PurchaseBillBuilder.GetPackageTypes();

            //load controls
            this.item = itemsku.Item;
            UpdateItemDetailControls(this.item);

            if (itemsku.ManufacturedDate != DateTime.MinValue)
            {
                chkDOM.Checked = true;
                dtpDOM.Enabled = true;
                dtpDOM.Value = itemsku.ManufacturedDate;
            }

            if (itemsku.ExpiredDate != DateTime.MinValue)
            {
                chkDOE.Checked = true;
                dtpDOE.Enabled = true;
                dtpDOE.Value = itemsku.ExpiredDate;
            }

            this.pack = itemsku.Package;
            if (this.pack != null)
                cmbPackType.SelectedIndex = cmbPackType.Items.IndexOf(this.pack.Name);
            nudNoPacks.Value = itemsku.PackageQuantity;
            nudItemsPerPack.Value = itemsku.QuantityPerPack;

            txtNetWght.Text = itemsku.NetWeight.ToString();
            txtGrossWght.Text = itemsku.GrossWeight.ToString();

            txtBasic.Text = itemsku.Basic.ToString();
            this.Basic = itemsku.Basic;
            txtTotalBasic.Text = (this.Basic * (nudNoPacks.Value * nudItemsPerPack.Value)).ToString("#.##");

            txtTransPercent.Text = itemsku.TransportPercent.ToString();
            //txtTrans.Text = itemsku.Transport.ToString();
            UpdateTransSet(itemsku.TransportPercent, 0, 0);

            txtMiscPercent.Text = itemsku.MiscPercent.ToString();
            //txtMisc.Text = itemsku.Misc.ToString();
            UpdateMiscSet(itemsku.MiscPercent, 0, 0);

            txtDiscPercent.Text = itemsku.DiscountPercent.ToString();
            ///txtDisc.Text = itemsku.Discount.ToString();
            UpdateDiscSet(itemsku.DiscountPercent, 0, 0);

            cmbVATPercent.SelectedIndex = cmbVATPercent.Items.IndexOf(itemsku.VATPercent);
            txtVAT.Text = itemsku.VAT.ToString("#.##");
            txtTotalVAT.Text = (itemsku.VAT * nudItemsPerPack.Value * nudNoPacks.Value).ToString("#.##");

            //this.VATPercent = itemsku.VATPercent;
            //this.MiscPercent = itemsku.MiscPercent;
            //this.DiscountPercent = itemsku.DiscountPercent;
            //this.TransPercent = itemsku.TransportPercent;

            //this.VAT = itemsku.VAT;
            //this.Misc = itemsku.Misc;
            //this.Discount = itemsku.Discount;
            //this.Trans = itemsku.Transport;

            //UpdateRates();
            UpdateRates();

            this.PurchaseRate = itemsku.PurchaseValue;

            this.WRatePercent = itemsku.WholesaleMargin;
            this.WRate = itemsku.Wholesale;

            this.RRatePercent = itemsku.RetailMargin;
            this.RRate = itemsku.Retail;

            txtPurchaseRate.Text = itemsku.PurchaseValue.ToString();
            //PurchaseRate = itemsku.PurchaseValue;

            txtWholePercent.Text = itemsku.WholesaleMargin.ToString();
            txtWholeMarginPrice.Text = ((WRatePercent != 0 ? (PurchaseRate * (WRatePercent / 100)) : 0) + PurchaseRate).ToString("#.##");
            txtWholeRate.Text = itemsku.Wholesale.ToString();
            UpdateWSaleSet();

            txtRetailPercent.Text = itemsku.RetailMargin.ToString();
            txtRetailMarginPrice.Text = ((RRatePercent != 0 ? (WRate * (RRatePercent / 100)) : 0) + WRate).ToString("#.##");
            txtRetailRate.Text = itemsku.Retail.ToString();
            UpdateRSaleSet();
        }
コード例 #3
0
        protected override void SaveToolStrip_Click(object sender, EventArgs e)
        {
            this.ProcessTabKey(true);
            List<string> exceptList = new List<string>() { "txtDisc", "txtDiscPercent","txtTotalDiscount" ,"txtMisc", "txtMiscPercent","txtTotalMisc" ,"txtTrans",
                                                           "txtTransPercent","txtTotalTrans" ,"txtVAT", "cmbVATPercent","txtTotalVAT", "txtBrand","cmbPackType","txtNoPacks","txtNetWght","txtGrossWght" };
            if (Utilities.Validation.IsNullOrEmpty(this, true, exceptList)) return;

            ItemPricing _itemPrice = new ItemPricing();

            _itemPrice.Item = item;
            _itemPrice.Basic = Basic;

            _itemPrice.Discount = Discount;
            _itemPrice.DiscountPercent = DiscountPercent;

            if (chkDOM.Checked == true)
                _itemPrice.ManufacturedDate = dtpDOM.Value;

            if (chkDOE.Checked == true)
                _itemPrice.ExpiredDate = dtpDOE.Value;

            _itemPrice.Transport = Trans;
            _itemPrice.TransportPercent = TransPercent;

            _itemPrice.Misc = Misc;
            _itemPrice.MiscPercent = MiscPercent;

            _itemPrice.VAT = chkIsExempted.Checked == true ? 0 : VAT;
            _itemPrice.VATPercent = chkIsExempted.Checked == true ? 0 : VATPercent;

            _itemPrice.Discount = Discount;
            _itemPrice.DiscountPercent = DiscountPercent;

            _itemPrice.Wholesale = WRate;
            _itemPrice.WholesaleMargin = WRatePercent;

            _itemPrice.Retail = RRate;
            _itemPrice.RetailMargin = RRatePercent;

            _itemPrice.PurchaseValue = PurchaseRate;

            if (this.pack != null)
                _itemPrice.Package = this.pack;
            _itemPrice.PackageQuantity = int.Parse(nudNoPacks.Value.ToString());
            _itemPrice.QuantityPerPack = int.Parse(nudItemsPerPack.Value.ToString());

            _itemPrice.NetWeight = string.IsNullOrEmpty(txtNetWght.Text) ? 0 : int.Parse(txtNetWght.Text);
            _itemPrice.GrossWeight = string.IsNullOrEmpty(txtGrossWght.Text) ? 0 : int.Parse(txtGrossWght.Text);

            Winform_PurchaseBill purchaseBill = Application.OpenForms["Winform_PurchaseBill"] as Winform_PurchaseBill;
            if (purchaseBill != null)
                purchaseBill.UpdateSKUItemList(this.Index, _itemPrice);

            UpdateStatus("ItemSKU Saved", 100);
            this.Close();
        }