コード例 #1
0
 private void AddProductFunction()
 {
     if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.Material))
     {
         objMaterial.MaterialCode  = cmbMaterial.SelectedValue.ToString();
         objGRNMaterials.GrossQty  = Convert.ToDecimal(txtQty.Text);
         objGRNMaterials.NetQty    = Convert.ToDecimal(txtQty.Text);
         objGRNMaterials.UnitPrice = Convert.ToDecimal(txtUnitPrice.Text);
         objGRNMaterials.Remarks   = "No";
         objGRNMaterials.Material  = objMaterial;
         objGRNMaterials_DL.Add(objGRNMaterials);
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.BasicProduct))
     {
         objBasicProduct.BasicProductCode = cmbMaterial.SelectedValue.ToString();
         objGRNBasicProducts.GrossQty     = Convert.ToDecimal(txtQty.Text);
         objGRNBasicProducts.NetQty       = Convert.ToDecimal(txtQty.Text);
         objGRNBasicProducts.UnitPrice    = Convert.ToDecimal(txtUnitPrice.Text);
         objGRNBasicProducts.Remarks      = "No";
         objGRNBasicProducts.BasicProduct = objBasicProduct;
         objGRNBasicProducts_DL.Add(objGRNBasicProducts);
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.FinishProduct))
     {
         objFinishProduct.FinishProductCode  = cmbMaterial.SelectedValue.ToString();
         objGRNFinishProducts.NetQty         = Convert.ToDecimal(txtQty.Text);
         objGRNFinishProducts.GrossQty       = Convert.ToDecimal(txtQty.Text);
         objGRNFinishProducts.UnitPrice      = Convert.ToDecimal(txtUnitPrice.Text);
         objGRNFinishProducts.Remarks        = "No";
         objGRNFinishProducts.FinishProducts = objFinishProduct;
         objGRNFinishProducts_DL.Add(objGRNFinishProducts);
     }
     clear();
     LoadGRNMaterialTable();
 }
コード例 #2
0
        private void btnGRN_Click(object sender, EventArgs e)
        {
            try
            {
                if (gvItemList.Rows.Count > 0)
                {
                    objGRN.GRNApprovedBy   = "N/A";
                    objGRN.GRNApprovedDate = DateTime.Now;
                    objGRN.GRNDate         = DateTime.Now;
                    objGRN.GRNEnterdBy     = CurrentUser.UserEmp.EmployeeID;
                    objGRN.GRNRPDBatch     = null;
                    objGRN.GRNStatus       = GRN.Status.Initial;
                    objGRN.GRNStore        = objStore;
                    objGRN.GRNCategory     = 1;
                    objGRN.GRNNo           = objGRNDL.Add_Direct(objGRN);
                    if (objGRN.GRNNo > 0)
                    {
                        if (objGRN.GRNType == GRN.Type.Material)
                        {
                            foreach (GRNMaterials obj in objGRNMaterialsCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNMaterialsDL.Add(obj);
                            }
                        }
                        else if (objGRN.GRNType == GRN.Type.BasicProduct)
                        {
                            foreach (GRNBasicProducts obj in objGRNBasicProductCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNBasicProductDL.Add(obj);
                            }
                        }
                        else if (objGRN.GRNType == GRN.Type.FinishProduct)
                        {
                            foreach (GRNFinishProducts obj in objGRNFinishProductCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNFinishProductDL.Add(obj);
                            }
                        }

                        objGRNDL.Approve(objGRN);
                        MessageBox.Show(this, "Suceessfully add to the Stock", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show(this, "There are no Items in the List, Please add Items before Continue", "Item List Empty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (cmbTerritory.SelectedIndex != -1)
            {
                try
                {
                    if (dgvProduct.Rows.Count > 0)
                    {
                        objStore = objStoreDL.Get(txtStore.Text);

                        objGRN.GRNApprovedBy   = "N/A";
                        objGRN.GRNApprovedDate = DateTime.Now;
                        objGRN.GRNDate         = DateTime.Now;
                        objGRN.GRNEnterdBy     = CurrentUser.UserEmp.EmployeeID;
                        objGRN.GRNType         = GRN.Type.FinishProduct;
                        // objGRN.GRNMR = objMR;
                        //objGRN.GRNMTNNo = objMTN;
                        objGRN.GRNRPDBatch = "N/A";

                        objGRN.GRNStatus   = GRN.Status.Initial;
                        objGRN.GRNStore    = objStore;
                        objGRN.GRNCategory = 0;


                        objGRN_Payment.InvoiceNo = "N/A";
                        objGRN_Payment.PONo      = "N/A";
                        objGRN_Payment.Supplier  = "N/A";

                        objGRN_Payment.InvoiceType = "N/A";



                        if ((objGRN_Payment.PONo == "") | (objGRN_Payment.InvoiceNo == "") | (objGRN_Payment.Supplier == ""))
                        {
                            MessageBox.Show(this, "Can Not Allow to GRN", "Missing PO/Invoice/Supplier", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        {
                            objGRN.GRNNo = objGRNDL.Add_Direct(objGRN);

                            objGRN_Payment.GRNNo = objGRN.GRNNo;

                            //
                            objGRN_Payment_DL.Add(objGRN_Payment);
                            objFinishGoodsReturn_DL.Add(objGRN.GRNNo, cmbCustomer.SelectedValue.ToString(), Convert.ToInt32(cmbTerritory.SelectedValue.ToString()));
                            //
                        }

                        if (objGRN.GRNNo > 0)
                        {
                            foreach (DataGridViewRow dr in dgvProduct.Rows)
                            {
                                String tempproductCode = dr.Cells[0].Value.ToString();
                                String tempproduct     = dr.Cells[1].Value.ToString();
                                long   tempqty         = Convert.ToInt64(dr.Cells[2].Value.ToString());
                                string tempstore       = dr.Cells[3].Value.ToString();

                                objFinishProduct.FinishProductCode = tempproductCode;
                                objGRNFinishProduct.NetQty         = tempqty;
                                objGRNFinishProduct.GrossQty       = tempqty;
                                objGRNFinishProduct.GRN            = objGRN;
                                objGRNFinishProduct.Remarks        = "No";
                                objGRNFinishProduct.UnitPrice      = 55;
                                objGRNFinishProduct.FinishProducts = objFinishProduct;

                                objGRNFinishProductDL.Add(objGRNFinishProduct);
                                //obj.GRN = objGRN;
                                //objGRNMaterialsDL.Add(obj);
                                //objGRNFinishProduct
                            }



                            clear();
                            MessageBox.Show(this, "Suceessfully add to the Dispose Stock", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, "There are no Items in the List, Please add Items before Continue", "Item List Empty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(this, "Please Select Customer", "MRP System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }