示例#1
0
        /*******************************************************************************************************/

        #region INITIALIZATION

        public Items_Form(Guid inventoryID)
        {
            InitializeComponent();

            Settings.setGeneralSettings(this);

            _inventory          = new Inventory(inventoryID);
            lblInventoryID.Text = String.Format("{0} - {1}", _inventory.code.ToString(), _inventory.product_store_name);
            lblLengthUnit.Text  = _inventory.length_unit_name;
            lblColor.Text       = _inventory.color_name;
            lblGrade.Text       = _inventory.grade_name;
            lblWidth.Text       = _inventory.product_width_name;
            lblReceiveDate.Text = string.Format("{0:dd/MM/yy HH:mm}", _inventory.receive_date);
            if (new FabricColor(_inventory.color_id).Allow2ndColor)
            {
                cbColors.Enabled    = true;
                btnAddColor.Enabled = true;
            }

            FabricColor.populateDropDownList(cbColors, false, true);
            disableForm();

            grid.AutoGenerateColumns                           = false;
            col_grid_id.DataPropertyName                       = InventoryItem.COL_DB_ID;
            col_grid_lastOpname.DataPropertyName               = InventoryItem.COL_LASTOPNAME;
            col_grid_ItemLocation.DataPropertyName             = InventoryItemCheck.COL_DB_ItemLocation;
            col_grid_colorname.DataPropertyName                = InventoryItem.COL_INVENTORYITEMCOLORNAME;
            col_grid_notes.DataPropertyName                    = InventoryItem.COL_DB_NOTES;
            col_grid_SaleOrderItemDescription.DataPropertyName = InventoryItem.COL_SaleOrderItemDescription;
            populateGrid();

            txtBarcode.MaxLength = Settings.itemBarcodeLength + Settings.itemBarcodeMandatoryPrefix.Length;
        }
        private void setupControls()
        {
            Settings.setGeneralSettings(this);

            ProductStoreName.populateDropDownList(cbProductStoreNames, false, false);
            Grade.populateDropDownList(cbGrades, false, false);
            ProductWidth.populateDropDownList(cbProductWidths, false, false);
            LengthUnit.populateDropDownList(cbLengthUnits, false, false);
            FabricColor.populateDropDownList(cbColors, false, false);

            grid.AutoGenerateColumns            = false;
            grid.SelectionMode                  = DataGridViewSelectionMode.FullRowSelect;
            col_grid_colorname.DataPropertyName = ProductPrice.COL_COLORNAME;
            col_grid_Checked.DataPropertyName   = ProductPrice.COL_DB_Checked;
            col_grid_BuyPrice.DataPropertyName  = ProductPrice.COL_DB_BuyPrice;

            if (GlobalData.UserAccount.role != Roles.Super)
            {
                col_grid_Checked.Visible  = false;
                chkOnlyNotOK.Visible      = false;
                in_BuyPrice.Visible       = false;
                col_grid_BuyPrice.Visible = false;
                btnDelete.Enabled         = false;
            }
        }
        private void setupControls()
        {
            Settings.setGeneralSettings(this);

            Grade.populateDropDownList(cbGrades, false, true);
            ProductWidth.populateDropDownList(cbProductWidths, false, true);
            LengthUnit.populateDropDownList(cbLengthUnits, false, true);
            FabricColor.populateDropDownList(cbColors, false, true);
            VendorInvoice.populateDropDownList(cbVendorInvoices, true);

            //set window title
            switch (_formMode)
            {
            case FormMode.New:
                this.Text       = "ADD NEW INVENTORY";
                lblCode.Visible = false;
                txtCode.Visible = false;
                break;

            case FormMode.Update:
                this.Text = "UPDATE INVENTORY";
                break;
            }

            if (GlobalData.UserAccount.role == Roles.User)
            {
                lblBuyPrice.Visible = false;
                txtBuyPrice.Visible = false;
                this.Height        -= 60;
            }
        }
        private void setupControls()
        {
            Settings.setGeneralSettings(this);

            FabricColor.populateDropDownList(cbColors, false, true);
            Tools.resetDropDownList(cbColors);

            pnlItem.Enabled  = false;
            lblBarcode.Text  = "";
            lblColor.Text    = "";
            lblGrade.Text    = "";
            lblItemInfo.Text = "";
            lblWidth.Text    = "";
        }
        /*******************************************************************************************************/
        #region METHODS

        protected override void setupFields()
        {
            Settings.setGeneralSettings(this);

            DoNotClearInputAfterSubmission = true;

            col_grid_name.Visible = false;
            disableFieldActive();

            btnAction1.Enabled = true;
            btnAction1.Text    = "DELETE";
            btnAction1.Width   = 100;

            btnAction2.Enabled = true;
            btnAction2.Text    = "CLEAR QTY";
            btnAction2.Width   = 100;

            btnAction3.Enabled = true;
            btnAction3.Text    = "CREATE PO";
            btnAction3.Width   = 100;

            btnAction4.Enabled = true;
            btnAction4.Text    = "HIDE COLUMNS";
            btnAction4.Width   = 120;

            btnAction5.Enabled = true;
            btnAction5.Text    = "-";
            btnAction5.Width   = 30;

            btnAction6.Enabled = true;
            btnAction6.Text    = "+";
            btnAction6.Width   = 30;

            //NOTES: must use inputColumns sequentially from the first one to the next. Otherwise calculation of the form width will be off

            //Field ID
            col_grid_id.DataPropertyName = InventoryStockLevel.COL_DB_ID;

            //Field Default
            col_grid_default.Visible = false;


            //Filter Vendor - dropdownlist
            _inputDDLVendors = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Vendor", InventoryStockLevel.COL_VENDORNAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            Vendor.populateDropDownList(_inputDDLVendors.Dropdownlist, false, true);                                                  //populate
            _inputDDLVendors.UpdateLink.LinkClicked            += new LinkLabelLinkClickedEventHandler(lnkUpdateVendors_LinkClicked); //add event handler for update link
            _inputDDLVendors.Dropdownlist.SelectedIndexChanged += new System.EventHandler(this.cbVendors_SelectedIndexChanged);
            _inputDDLVendors.Dropdownlist.TextChanged          += new System.EventHandler(this.cbVendors_TextChanged);

            //Field Name/Store - dropdownlist
            _inputDDLProducts = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Product", InventoryStockLevel.COL_PRODUCTSTORENAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLProducts.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateProducts_LinkClicked); //add event handler for update link
            _inputDDLProducts.Enabled = false;

            //Field Grades - dropdownlist
            _inputDDLGrades = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Grade", InventoryStockLevel.COL_GRADE_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLGrades.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateGrades_LinkClicked); //add event handler for update link
            Grade.populateDropDownList(_inputDDLGrades.Dropdownlist, false, true);                                       //populate

            //Field Product Widths - dropdownlist
            _inputDDLProductWidths = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 0, "Lebar", InventoryStockLevel.COL_PRODUCT_WIDTH_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLGrades.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateProductWidths_LinkClicked); //add event handler for update link
            ProductWidth.populateDropDownList(_inputDDLProductWidths.Dropdownlist, false, true);                                //populate

            //Field Color - dropdownlist
            _inputDDLColors = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Color", InventoryStockLevel.COL_COLOR_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLColors.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateColors_LinkClicked); //add event handler for update link
            FabricColor.populateDropDownList(_inputDDLColors.Dropdownlist, false, true);                                 //populate

            //Field Length Units - dropdownlist
            _inputDDLLengthUnits = (InputDropdownlist)setupInputControl(new InputDropdownlist(), 1, "Unit", InventoryStockLevel.COL_LENGTH_UNIT_NAME, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputDDLLengthUnits.UpdateLink.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkUpdateLengthUnits_LinkClicked); //add event handler for update link
            LengthUnit.populateDropDownList(_inputDDLLengthUnits.Dropdownlist, false, true);                                       //populate

            //Field Lot Qty - textbox
            _inputTxtOrderLotQty = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Lot Qty", InventoryStockLevel.COL_DB_ORDERLOTQTY, (int)MasterDataColumnWidth.Fit, true, false, null);
            _inputTxtOrderLotQty.setMaxLength(5); //set max length

            //Field Qty - textbox
            _inputTxtQty = (InputTextbox)setupInputControl(new InputTextbox(), 1, "Min Qty", InventoryStockLevel.COL_DB_QTY, 40, true, false, null);
            _inputTxtQty.setMaxLength(5); //set max length

            //add columns
            col_grid_remainingQty                 = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_remainingQty", "Stock", InventoryStockLevel.COL_REMAININGSTOCKQTY, 40, true, null);        //add field to gridview
            col_grid_bookedQty                    = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_bookedQty", "Booked", InventoryStockLevel.COL_BOOKEDQTY, 50, true, null);                  //add field to gridview
            col_grid_orderQty                     = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_orderQty", "Pending", InventoryStockLevel.COL_PENDINGDELIVERYQTY, 50, true, null);         //add field to gridview
            col_grid_newQty                       = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_newQty", "Order", InventoryStockLevel.COL_NEWORDER_QTY, 40, false, null);                  //add field to gridview
            col_grid_lastOrderInventoryID         = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_referencedInventoryID", "", InventoryStockLevel.COL_LASTORDERINVENTORYID, 40, true, null); //add field to gridview
            col_grid_lastOrderInventoryID.Visible = false;
            col_grid_lastOrderTimestamp           = Tools.addColumn <DataGridViewTextBoxCell>(gridview, "col_grid_lastOrderTimestamp", "", InventoryStockLevel.COL_LASTORDERTIMESTAMP, 40, true, null);      //add field to gridview
            col_grid_lastOrderTimestamp.Visible   = false;

            //Field PO Notes - textbox
            _inputTxtPONotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "PO Notes", InventoryStockLevel.COL_DB_PONOTES, (int)MasterDataColumnWidth.Fit, false, true, null);
            _inputTxtPONotes.setToMultiline(4);
            _inputTxtPONotes.setMaxLength(50); //set max length

            //Field Notes - textbox
            _inputTxtNotes = (InputTextbox)setupInputControl(new InputTextbox(), 2, "Notes", InventoryStockLevel.COL_DB_NOTES, 100, false, true, null);
            _inputTxtNotes.setToMultiline(4);
            _inputTxtNotes.setMaxLength(100); //set max length
            gridview.Columns[InventoryStockLevel.COL_DB_NOTES].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            //set default control to focus
            DefaultInputToFocus = _inputDDLVendors;

            clearInputFields(); //clear dropdownlists

            if (GlobalData.UserAccount.role != Roles.Super)
            {
                btnAction1.Enabled = false;
                btnAction3.Enabled = false;
                gridview.Columns[InventoryStockLevel.COL_DB_PONOTES].Visible = false;
            }
        }
 private void lnkUpdateColors_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Tools.displayForm(new MasterData.FabricColors_Form(FormMode.New));
     FabricColor.populateDropDownList(_inputDDLColors.Dropdownlist, false, true);
 }
示例#7
0
 private void btnAddColor_Click(object sender, EventArgs e)
 {
     Tools.displayForm(new MasterData.FabricColors_Form(FormMode.New));
     FabricColor.populateDropDownList(cbColors, false, true);
 }