private void setupControls()
        {
            Settings.setGeneralSettings(this);

            GordenItem.populateDropDownList(dropFabrics, false, GordenItemCategories.Gorden);
            GordenItem.populateDropDownList(dropVitrages, false, GordenItemCategories.Vitrage);
            GordenItem.populateDropDownList(dropRings, false, GordenItemCategories.Ring, GordenItemCategories.SmokeRing, GordenItemCategories.KawatRoda);
            GordenItem.populateDropDownList(dropRails1, false, GordenItemCategories.Rel);
            GordenItem.populateDropDownList(dropRails2, false, GordenItemCategories.Rel);
            GordenItem.populateDropDownList(dropKaki, false, GordenItemCategories.KakiRel);
            GordenItem.populateDropDownList(dropHooks, false, GordenItemCategories.Hook);
            GordenItem.populateDropDownList(dropTasels, false, GordenItemCategories.Tasel);

            gridmain.AutoGenerateColumns              = false;
            gridmain.SelectionMode                    = DataGridViewSelectionMode.FullRowSelect;
            col_gridmain_id.DataPropertyName          = GordenOrderItem.COL_DB_ID;
            col_gridmain_lineno.DataPropertyName      = GordenOrderItem.COL_DB_LINENO;
            col_gridmain_description.DataPropertyName = GordenOrderItem.COL_DB_DESCRIPTION;
            Tools.setGridviewColumnWordwrap(col_gridmain_description);
            col_gridmain_qty.DataPropertyName          = GordenOrderItem.COL_DB_QTY;
            col_gridmain_priceperunit.DataPropertyName = GordenOrderItem.COL_DB_SELLAMOUNTPERUNIT;
            col_gridmain_notes.DataPropertyName        = GordenOrderItem.COL_DB_NOTES;
            col_gridmain_subtotal.DataPropertyName     = GordenOrderItem.COL_SUBTOTAL;

            Customer.populateDropDownList(dropCustomers, false, true);
            lblCustomerInfo.Text = _customerInfo;
        }
Example #2
0
 protected override void add()
 {
     GordenItem.add(_inputTxtName.TextValue, Tools.parseEnum <GordenItemCategories>(_inputDDLCategories.SelectedValue),
                    (Guid)_inputDDLVendors.SelectedValue, (Guid)_inputDDLRetailLengthUnits.SelectedValue, (Guid)_inputDDLBulkLengthUnits.SelectedValue, (Guid?)_inputDDLProductWidths.SelectedValue,
                    Tools.zeroNonNumericString(_inputTxtBuyRetailPricePerUnit.TextValue), Tools.zeroNonNumericString(_inputTxtBuyBulkPricePerUnit.TextValue),
                    Tools.zeroNonNumericString(_inputTxtSellRetailPricePerUnit.TextValue), Tools.zeroNonNumericString(_inputTxtSellBulkPricePerUnit.TextValue), _inputTxtNotes.TextValue);
 }
        private decimal addRing(ref List <GordenOrderItemMaterial> materials, Guid?gordenOrderItemID, ref decimal subTotal, ref string description)
        {
            decimal qty = 0;

            if (Tools.isDropdownlistSelected(dropRings))
            {
                GordenItem item  = new GordenItem((Guid)dropRings.SelectedValue);
                decimal    width = Tools.zeroNonNumericString(txtItemWidth.Text);

                //fabric lebar dibawah dan diatas 2.4meter berbeda cara hitung nya. Tetapi disini disamakan saja dengan lebar kain 2.4meter dan dibulatkan ke atas.
                //Perbedaan sekitar kelebihan 1-2 lubang dianggap biaya. Perbedaan karena potongan lebar 1.20meter menyebabkan jumlah lubang yang diperlukan menjadi lebih.
                if (item.CategoryEnumID == GordenItemCategories.SmokeRing)
                {
                    qty = Math.Ceiling(width * 3 * 8);
                }
                else if (item.CategoryEnumID == GordenItemCategories.Ring)
                {
                    qty = Math.Ceiling(width * 3 * 10);
                }
                else
                {
                    qty = Math.Ceiling(width * 3 * 10);
                }

                subTotal   += qty * item.SellRetailPricePerUnit;
                description = Tools.append(description, string.Format("Rings: {0}", dropRings.Text), Environment.NewLine);
                materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
            }
            return(qty);
        }
        //private void addKawatRoda(ref List<GordenOrderItemMaterial> materials, Guid? gordenOrderItemID, ref decimal subTotal, decimal ringQty, ref string description)
        //{
        //    decimal qty = ringQty;
        //    if (Tools.isDropdownlistSelected(dropKawatRoda) && new GordenItem((Guid)dropRings.SelectedValue).CategoryEnumID == GordenItemCategories.Ring)
        //    {
        //        GordenItem item = new GordenItem((Guid)dropKawatRoda.SelectedValue);

        //        subTotal += qty * item.SellRetailPricePerUnit;
        //        description = Tools.append(description, string.Format("Kawat: {0}", dropKawatRoda.Text), Environment.NewLine);
        //        materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
        //    }
        //}

        private void addHook(ref List <GordenOrderItemMaterial> materials, Guid?gordenOrderItemID, ref decimal subTotal, ref string description)
        {
            decimal qty = 2;

            if (Tools.isDropdownlistSelected(dropHooks))
            {
                GordenItem item = new GordenItem((Guid)dropHooks.SelectedValue);

                subTotal   += qty * item.SellRetailPricePerUnit;
                description = Tools.append(description, string.Format("Hook: {0:N0} x {1}", qty, dropHooks.Text), Environment.NewLine);
                materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
            }
        }
Example #5
0
        protected override void populateInputFields()
        {
            GordenItem obj = new GordenItem(selectedRowID());

            _inputTxtName.TextValue                   = obj.Name;
            _inputDDLCategories.SelectedValue         = obj.CategoryEnumID;
            _inputDDLVendors.SelectedValue            = obj.VendorID;
            _inputDDLProductWidths.SelectedValue      = obj.ProductWidthID;
            _inputDDLRetailLengthUnits.SelectedValue  = obj.RetailLengthUnitID;
            _inputDDLBulkLengthUnits.SelectedValue    = obj.BulkLengthUnitID;
            _inputTxtBuyRetailPricePerUnit.TextValue  = obj.BuyRetailPricePerUnit.ToString("N2");
            _inputTxtBuyBulkPricePerUnit.TextValue    = obj.BuyBulkPricePerUnit.ToString("N2");
            _inputTxtSellRetailPricePerUnit.TextValue = obj.SellRetailPricePerUnit.ToString("N2");
            _inputTxtSellBulkPricePerUnit.TextValue   = obj.SellBulkPricePerUnit.ToString("N2");
            _inputTxtNotes.TextValue                  = obj.Notes;
        }
        private void addRail(ref List <GordenOrderItemMaterial> materials, Guid?gordenOrderItemID, ref decimal subTotal, ComboBox drop, ref string description)
        {
            decimal qty = Tools.zeroNonNumericString(txtItemWidth.Text);

            if (Tools.isDropdownlistSelected(drop))
            {
                GordenItem item = new GordenItem((Guid)drop.SelectedValue);

                subTotal += qty * item.SellRetailPricePerUnit;
                if (Tools.isDropdownlistSelected(drop))
                {
                    description = Tools.append(description, string.Format("Rel: {0:N2} mtr {1}", txtItemWidth.Text, drop.Text), Environment.NewLine);
                }
                materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
            }
        }
Example #7
0
        protected override Boolean isInputFieldsValid()
        {
            if (string.IsNullOrEmpty(_inputTxtName.TextValue))
            {
                return(_inputTxtName.TextError("Please provide name"));
            }
            else if ((Mode != FormMode.Update && GordenItem.isNameExist(_inputTxtName.TextValue, null)) ||
                     (Mode == FormMode.Update && GordenItem.isNameExist(_inputTxtName.TextValue, selectedRowID())))
            {
                return(_inputTxtName.TextError("Name is already in the list"));
            }
            else if (_inputDDLCategories.SelectedValue == null)
            {
                return(_inputDDLCategories.SelectedValueError("Please select category"));
            }
            else if (_inputDDLVendors.SelectedValue == null)
            {
                return(_inputDDLVendors.SelectedValueError("Please select vendor"));
            }
            else if (_inputDDLRetailLengthUnits.SelectedValue == null)
            {
                return(_inputDDLRetailLengthUnits.SelectedValueError("Please select retail unit"));
            }
            else if (_inputDDLBulkLengthUnits.SelectedValue == null)
            {
                return(_inputDDLBulkLengthUnits.SelectedValueError("Please select bulk unit"));
            }
            else if (!string.IsNullOrWhiteSpace(_inputTxtBuyRetailPricePerUnit.TextValue) && !Tools.isNumeric(_inputTxtBuyRetailPricePerUnit.TextValue))
            {
                return(_inputTxtBuyRetailPricePerUnit.TextError("Invalid Buy Retail Price Per Unit"));
            }
            else if (!string.IsNullOrWhiteSpace(_inputTxtBuyBulkPricePerUnit.TextValue) && !Tools.isNumeric(_inputTxtBuyBulkPricePerUnit.TextValue))
            {
                return(_inputTxtBuyBulkPricePerUnit.TextError("Invalid Buy Bulk Price Per Unit"));
            }
            else if (!string.IsNullOrWhiteSpace(_inputTxtSellRetailPricePerUnit.TextValue) && !Tools.isNumeric(_inputTxtSellRetailPricePerUnit.TextValue))
            {
                return(_inputTxtSellRetailPricePerUnit.TextError("Invalid Sell Retail Price Per Unit"));
            }
            else if (!string.IsNullOrWhiteSpace(_inputTxtSellBulkPricePerUnit.TextValue) && !Tools.isNumeric(_inputTxtSellBulkPricePerUnit.TextValue))
            {
                return(_inputTxtSellBulkPricePerUnit.TextError("Invalid Sell Bulk Price Per Unit"));
            }

            return(true);
        }
        private void addVitrage(ref List <GordenOrderItemMaterial> materials, Guid?gordenOrderItemID, ref decimal subTotal, ref string description)
        {
            decimal qty = 0;

            if (Tools.isDropdownlistSelected(dropVitrages))
            {
                GordenItem item = new GordenItem((Guid)dropVitrages.SelectedValue);

                qty = (Tools.zeroNonNumericString(txtItemWidth.Text) * 3) + (decimal)0.25; //sama dengan perhitungan kain lebar > 2.4m

                subTotal += qty * item.SellRetailPricePerUnit;
                if (Tools.isDropdownlistSelected(dropVitrages))
                {
                    description = Tools.append(description, string.Format("Vitrage: {0}", dropVitrages.Text, item.ProductWidthInMeter), Environment.NewLine);
                }
                materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
            }
        }
        private decimal addFabric(ref List <GordenOrderItemMaterial> materials, Guid?gordenOrderItemID, ref decimal subTotal, ref string description)
        {
            decimal qty = 0;

            if (Tools.isDropdownlistSelected(dropFabrics))
            {
                GordenItem item = new GordenItem((Guid)dropFabrics.SelectedValue);

                //calculate usage
                if (item.ProductWidthInMeter < (decimal)2.4)
                {
                    qty = (Tools.zeroNonNumericString(txtItemWidth.Text) * 2) * (Tools.zeroNonNumericString(txtItemHeight.Text) + (decimal)0.25);
                }
                else
                {
                    qty = (Tools.zeroNonNumericString(txtItemWidth.Text) * 3) + (decimal)0.25;
                }

                //calculate tali
                if (rbTali.Checked)
                {
                    qty += (decimal)0.2;
                }

                subTotal   += qty * item.SellRetailPricePerUnit;
                description = Tools.append(description, string.Format("{0}", dropFabrics.Text.Trim(), item.ProductWidthInMeter), Environment.NewLine);
                if (chkSplitGorden.Checked)
                {
                    description = Tools.append(description, "- BAGI 2", "");
                }

                DBUtil.sanitize(txtFabricColorCode);
                if (!string.IsNullOrWhiteSpace(txtFabricColorCode.Text))
                {
                    description = Tools.append(description, string.Format("(Warna: {0})", DBUtil.sanitize(txtFabricColorCode)), " ");
                }

                description = Tools.append(description, string.Format("Tali: {0}", Tools.getYEsOrNo(rbTali.Checked)), Environment.NewLine);
                materials.Add(new GordenOrderItemMaterial(gordenOrderItemID, item.ID, qty, null));
            }
            return(qty);
        }
Example #10
0
 protected override void updateActiveStatus(Guid id, Boolean activeStatus)
 {
     GordenItem.updateActiveStatus(id, activeStatus);
 }
Example #11
0
 protected override System.Data.DataView loadGridviewDataSource()
 {
     return(GordenItem.get(chkIncludeInactive.Checked, null, null, null, null, null, null, _category).DefaultView);
 }