Ejemplo n.º 1
0
 public SupplierForm()
 {
     InitializeComponent();
     suppliercbm           = new pts_supplier();
     ptssupllier           = new pts_supplier();
     supplierData          = new pts_supplier();
     editMode              = false;
     btnUpdate.Enabled     = false;
     btnDelete.Enabled     = false;
     pnlButtons.Visible    = true;
     pnlSubButtons.Visible = false;
 }
Ejemplo n.º 2
0
 public StockInputForm()
 {
     InitializeComponent();
     itemData         = new pts_item();
     printItem        = new PrintItem();
     stockItem        = new pts_stock();
     premacData       = new pre_649();
     supplierItem     = new pts_supplier();
     listPrintItem    = new List <PrintItem>();
     listPremac       = new List <pre_649>();
     listInputPremac  = new List <pre_649>();
     listStockItem    = new BindingList <pts_stock>();
     tc_Main.ItemSize = new Size(0, 1);
 }
Ejemplo n.º 3
0
 public StockDetailForm()
 {
     InitializeComponent();
     itemData     = new pts_item();
     olditemData  = new pts_item();
     stockData    = new pts_stock();
     oldStockData = new pts_stock();
     userData     = new m_mes_user();
     stockLog     = new pts_stock_log();
     typeData     = new pts_item_type();
     supplierData = new pts_supplier();
     listStockLog = new List <pts_stock_log>();
     tc_MainStockDetail.ItemSize = new Size(0, 1);
 }
Ejemplo n.º 4
0
 public StockOutForm()
 {
     InitializeComponent();
     tc_Main.ItemSize = new Size(0, 1);
     supplierData     = new pts_supplier();
     printData        = new PrintItem();
     outData          = new OutputItem();
     itemData         = new pts_item();
     stockData        = new pts_stock();
     mUserData        = new m_mes_user();
     noplanData       = new pts_noplan();
     issueCode        = new pts_issue_code();
     stockOutData     = new pts_stockout_log();
     destinationData  = new pts_destination();
     listPrintItems   = new List <PrintItem>();
     listStock        = new List <pts_stock>();
     listNoPlan       = new List <pts_noplan>();
     listStockOut     = new List <pts_stockout_log>();
 }
Ejemplo n.º 5
0
        private void txtSetStockOutQty_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string itemCode = txtSetLowItemCode.Text;

                    pts_stock stockData = new pts_stock();
                    #region CHECK ITEM IS EXIST IN STOCK?
                    if (!stockData.SearchItem(new pts_stock {
                        item_cd = itemCode, invoice = txtSetInvoice.Text
                    }))
                    {
                        CustomMessageBox.Error("This item is not exist in stock!");
                        txtSetLowItem.Clear();
                        txtSetInvoice.Clear();
                        txtSetLowItem.Focus();
                        return;
                    }
                    #endregion

                    #region GET INDEX OF ITEM IF IT IS EXIST IN SET LIST
                    int rindex = 0;
                    try
                    {
                        rindex = dgvSetData.Rows.Cast <DataGridViewRow>()
                                 .Where(x => x.Cells["low_level_item"].Value.ToString() == itemCode)
                                 .Select(x => x.Index).First();
                    }
                    catch (Exception ex)
                    {
                        CustomMessageBox.Error("This item is not exist in list!" + Environment.NewLine + ex.Message);
                        txtSetLowItem.Clear();
                        txtSetInvoice.Clear();
                        txtSetLowItem.Focus();
                        return;
                    }
                    #endregion

                    DataGridViewRow dr = dgvSetData.Rows[rindex];
                    double          totalpackingQty = stockData.listStockItems.Sum(x => x.packing_qty);
                    double          packingQty      = double.Parse(txtSetStockOutQty.Text);
                    double          orderQty        = (double)dr.Cells["request_qty"].Value;
                    //double stockQty = (double)dr.Cells["wh_qty"].Value;
                    double stockoutQty = 0;
                    double residualQty = 0;
                    if (dr.Cells["stockout_qty"].Value != null)
                    {
                        stockoutQty = (double)dr.Cells["stockout_qty"].Value;
                    }

                    //Check qty of label
                    if (packingQty > totalpackingQty)
                    {
                        packingQty = totalpackingQty;
                        CustomMessageBox.Notice("Packing Qty of this item is empty! Please stock-in first!");
                    }
                    stockoutQty += packingQty;
                    if (stockoutQty > orderQty)
                    {
                        packingQty -= stockoutQty - orderQty;
                        stockoutQty = orderQty;
                    }
                    residualQty = totalpackingQty - packingQty;
                    dr.Cells["stockout_qty"].Value = stockoutQty;
                    //ADD OUTPUT ITEM FOR CSV
                    listOut.Add(new OutputItem
                    {
                        issue_cd       = 20,
                        destination_cd = cmbDestination.SelectedValue.ToString(),
                        item_number    = itemCode,
                        delivery_qty   = packingQty,
                        delivery_date  = dtpStockOutDate.Value,
                        order_number   = txtSetOrderNum.Text,
                        incharge       = txtSetUserCD.Text,
                    });

                    pts_supplier supplierData = new pts_supplier();
                    foreach (pts_stock item in stockData.listStockItems)
                    {
                        if (item.packing_qty == 0)
                        {
                            continue;
                        }
                        //ADD NEW STOCK OUT LOG
                        listStockOut.Add(new pts_stockout_log
                        {
                            packing_cd       = item.packing_cd,
                            process_cd       = txtSetOrderNum.Text,
                            issue_cd         = 20,
                            stockout_date    = dtpStockOutDate.Value,
                            stockout_user_cd = txtSetUserCD.Text,
                            stockout_qty     = packingQty,
                            comment          = txtComment.Text,
                            remark           = "N",
                        });
                        if (packingQty < item.packing_qty)
                        {
                            item.packing_qty -= packingQty;
                            //ADD STOCK-IN TO PRINT LIST
                            listPrint.Add(new PrintItem
                            {
                                Item_Number  = item.item_cd,
                                Item_Name    = dr.Cells["item_name"].Value.ToString(),
                                SupplierName = supplierData.GetSupplier(new pts_supplier {
                                    supplier_cd = item.supplier_cd
                                }).supplier_name,
                                Invoice       = txtSetInvoice.Text,
                                Delivery_Date = item.stockin_date,
                                Delivery_Qty  = item.packing_qty,
                                SupplierCD    = item.supplier_cd,
                                isRec         = true,
                                Label_Qty     = 1
                            });
                            //ADD STOCK-OUT TO PRINT LIST
                            listPrint.Add(new PrintItem
                            {
                                Item_Number  = item.item_cd,
                                Item_Name    = dr.Cells["item_name"].Value.ToString(),
                                SupplierName = supplierData.GetSupplier(new pts_supplier {
                                    supplier_cd = item.supplier_cd
                                }).supplier_name,
                                Invoice       = txtSetInvoice.Text,
                                Delivery_Date = dtpStockOutDate.Value,
                                Delivery_Qty  = packingQty,
                                SupplierCD    = item.supplier_cd,
                                isRec         = false,
                                Label_Qty     = 1
                            });
                            packingQty = 0;
                        }
                        else
                        {
                            packingQty      -= item.packing_qty;
                            item.packing_qty = 0;
                        }
                        listStock.Add(item);
                        if (packingQty == 0)
                        {
                            break;
                        }
                    }
                    dr.DefaultCellStyle.BackColor = Color.FromKnownColor(KnownColor.ActiveCaption);
                    UpdateGridStockOut(listStockOut);
                    UpdateGridPrint(listPrint);
                    txtSetLowItem.Clear();
                    txtSetLowItem.Focus();
                }
            }
            catch (Exception ex)
            {
                CustomMessageBox.Error(ex.Message);
                txtSetLowItem.Clear();
                txtSetInvoice.Clear();
                txtSetLowItem.Focus();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create list no plan items
        /// </summary>
        private void CreateListNoSet()
        {
            if (!CheckFields())
            {
                return;
            }
            if (txtStockOutQty.Text == "0" || string.IsNullOrEmpty(txtStockOutQty.Text))
            {
                CustomMessageBox.Notice("Please fill Stock-Out Q'ty");
                return;
            }
            double deliveryQty = 0;
            double whQty       = double.Parse(txtWHQty.Text);
            double stockoutQty = double.Parse(txtStockOutQty.Text);

            if (stockoutQty > whQty)
            {
                CustomMessageBox.Notice("This item is not enough!");
                return;
            }
            //CALCULATOR STOCK AND STOCK OUT QTY
            pts_stock    currentStock = new pts_stock();
            pts_supplier supplierData = new pts_supplier();

            foreach (DataGridViewRow dr in dgvMainStockOut.Rows)
            {
                currentStock = dr.DataBoundItem as pts_stock;
                if (currentStock.packing_qty == 0 && stockoutQty > 0)
                {
                    continue;
                }
                if (stockoutQty >= currentStock.packing_qty)
                {
                    deliveryQty = currentStock.packing_qty;
                    currentStock.packing_qty = 0;
                    stockoutQty -= deliveryQty;
                }
                else
                {
                    deliveryQty = stockoutQty;
                    stockoutQty = 0;
                    currentStock.packing_qty -= deliveryQty;
                }

                #region ADD LIST STOCK AND LIST STOCK OUT
                listStock.Add(currentStock);
                listStockOut.Add(new pts_stockout_log
                {
                    packing_cd       = currentStock.packing_cd,
                    process_cd       = processCD,
                    issue_cd         = (int)cmbIssue.SelectedValue,
                    stockout_date    = dtpStockOutDate.Value,
                    stockout_user_cd = txtSetUserCD.Text,
                    stockout_qty     = deliveryQty,
                    comment          = txtComment.Text,
                    remark           = "N",
                });
                if (currentStock.packing_qty > 0)
                {
                    listPrint.Add(new PrintItem
                    {
                        Item_Number  = txtItemCode.Text,
                        Item_Name    = lbItemName.Text,
                        SupplierName = supplierData.GetSupplier(new pts_supplier {
                            supplier_cd = currentStock.supplier_cd
                        }).supplier_name,
                        Invoice       = currentStock.invoice,
                        Delivery_Date = currentStock.stockin_date,
                        Delivery_Qty  = currentStock.packing_qty,
                        SupplierCD    = currentStock.supplier_cd,
                        isRec         = true,
                        Label_Qty     = 1,
                    });
                    listPrint.Add(new PrintItem
                    {
                        Item_Number  = txtItemCode.Text,
                        Item_Name    = lbItemName.Text,
                        SupplierName = supplierData.GetSupplier(new pts_supplier {
                            supplier_cd = currentStock.supplier_cd
                        }).supplier_name,
                        Invoice       = currentStock.invoice,
                        Delivery_Date = dtpStockOutDate.Value,
                        Delivery_Qty  = deliveryQty,
                        SupplierCD    = currentStock.supplier_cd,
                        isRec         = false,
                        Label_Qty     = 1,
                    });
                }
                #endregion
                //ADD LIST OUPUT ITEM
                listOut.Add(new OutputItem
                {
                    issue_cd       = (int)cmbIssue.SelectedValue,
                    destination_cd = cmbDestination.SelectedValue.ToString(),
                    item_number    = currentStock.item_cd,
                    delivery_qty   = deliveryQty,
                    delivery_date  = dtpStockOutDate.Value,
                    order_number   = string.Empty,
                    incharge       = txtUserCode.Text,
                });
                if (stockoutQty == 0)
                {
                    break;
                }
            }
            UpdateGridPrint(listPrint);
            UpdateGridStockOut(listStockOut);
            tc_StockOut.SelectedTab = tab_Print;
        }