예제 #1
0
 /// <summary>
 /// Function for Return from productCreationPopup
 /// </summary>
 /// <param name="decProductId"></param>
 public void ReturnFromProductCreation(decimal decProductId)
 {
     frmProductCreation productcreation = new frmProductCreation();
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     try
     {
         int inI = dgvPurchaseReturn.CurrentRow.Index;
         this.Enabled = true;
         base.Show();
         if (decProductId != 0)
         {
             infoProduct = spProduct.ProductView(decProductId);
             strProductCode = infoProduct.ProductCode;
             productDetailsFillFromProductCreation(productcreation, decProductId, inI);
         }
         dgvPurchaseReturn.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
        /// <summary>
        /// Function to call frmProductSearchPopup form to select and view product
        /// </summary>
        /// <param name="frmProductSearchPopup"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
        {
            ProductSP SpProduct = new ProductSP();
            ProductInfo infoProduct = new ProductInfo();
            try
            {
                this.Enabled = true;
                this.BringToFront();

                this.frmProductSearchPopupObj = frmProductSearchPopup;
                int inCurrentRowIndex = dgvProduct.CurrentRow.Index;
                dgvProduct.Rows.Add();
                if (decproductId != 0)
                {
                    infoProduct = SpProduct.ProductView(decproductId);


                    TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill();
                    SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP();
                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
                    dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value = infoProduct.ProductId;
                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode;
                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate, PublicVariables._inNoOfDecimalPlaces);
                    DefaultRate = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces);

                    dtblUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, infoProduct.ProductId.ToString(), inCurrentRowIndex);
                    dtblbatchViewAll = SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, infoProduct.ProductId, inCurrentRowIndex);

                    BatchSP spBatch = new BatchSP();
                    decimal decBatchId = spBatch.BatchIdViewByProductId(infoProduct.ProductId);
                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value = decBatchId;
                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;

                    if (infoProduct.PartNo != string.Empty)
                    {
                        dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = infoProduct.PartNo;
                    }
                    else
                    {
                        if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                        {
                            decBatchId = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbBatch"].Value);
                            dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = SpProduct.BarcodeViewByBatchId(decBatchId);
                        }
                    }
                    IsDoAfterFill = true;
                    UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                    DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[inCurrentRowIndex].Cells["ProductId"].Value.ToString());
                    if (dtblUnitByProduct.Rows.Count > 0)
                    {
                        foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                        {
                            if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                            {
                                dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                                dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                                if (IsDoAfterFill)
                                {
                                    decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                                    decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate;
                                    dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, PublicVariables._inNoOfDecimalPlaces);
                                }
                            }
                        }
                    }
                    decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(infoProduct.ProductId, PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces);
                    if (dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty)
                    {
                        if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value) != 0)
                        {
                            dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[inCurrentRowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces);
                        }
                    }
                    dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Value = "X";
                    dgvProduct.Rows[inCurrentRowIndex].HeaderCell.Style.ForeColor = Color.Red;
                }
                frmProductSearchPopupObj.Close();
                frmProductSearchPopupObj = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("SQ:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #3
0
 /// <summary>
 /// Function to fill the dataGridView from productSearchPopup when Cntrl+F navigation key used
 /// </summary>
 /// <param name="frmProductSearchPopup"></param>
 /// <param name="decproductId"></param>
 /// <param name="decCurrentRowIndex"></param>
 public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         base.Show();
         this.frmProductSearchPopupObj = frmProductSearchPopup;
         UnitConvertionSP SPUnitConversion = new UnitConvertionSP();
         infoProduct = spProduct.ProductView(decproductId);
         int inRowcount = dgvPurchaseReturn.Rows.Count;
         if (decCurrentRowIndex == inRowcount - 1)
         {
             dgvPurchaseReturn.Rows.Add();
         }
         for (int i = 0; i < inRowcount; i++)
         {
             if (i == decCurrentRowIndex)
             {
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode;
                 FillProductDetails(infoProduct.ProductCode.ToString(), i);
             }
         }
         frmProductSearchPopupObj.Close();
         frmProductSearchPopupObj = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #4
0
 /// <summary>
 /// Function to fill the product details in dataGridView from productCreationPopup
 /// </summary>
 /// <param name="productcreation"></param>
 /// <param name="decproductId"></param>
 /// <param name="decCurrentRowIndex"></param>
 public void productDetailsFillFromProductCreation(frmProductCreation productcreation, decimal decproductId, decimal decCurrentRowIndex)
 {
     try
     {
         decimal decCurrentConversionRate = 0;
         DataTable dtbl = new DataTable();
         UnitConvertionSP SPUnitConversion = new UnitConvertionSP();
         BatchSP spBatch = new BatchSP();
         ProductInfo infoProductFill = new ProductInfo();
         ProductSP spproduct = new ProductSP();
         ProductInfo infoProduct = new ProductInfo();
         int inI = dgvPurchaseReturn.CurrentRow.Index;
         if (inI == dgvPurchaseReturn.Rows.Count - 1)
         {
             dgvPurchaseReturn.Rows.Add();
         }
         if (decproductId != 0)
         {
             infoProduct = spproduct.ProductView(decproductId);
             SerialNo();
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode;
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductId"].Value = decproductId.ToString();
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtproductName"].Value = infoProduct.ProductName;
             dgvPurchaseReturn.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
             dgvPurchaseReturn.Rows[inI].Cells["dgvcmbRack"].Value = infoProduct.RackId;
             UnitComboFill(infoProduct.ProductId, dgvPurchaseReturn.CurrentRow.Index, dgvPurchaseReturn.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex);
             dgvPurchaseReturn.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtrate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces);
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionSP().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId));
             dgvPurchaseReturn.CurrentRow.Cells["dgvtxtConversionRate"].Value = SPUnitConversion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvPurchaseReturn.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString()));
             BatchComboFill(decproductId, inI, dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex);
             dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decproductId);
             RackComboFill(infoProduct.GodownId, inI, dgvPurchaseReturn.Rows[inI].Cells["dgvcmbRack"].ColumnIndex);
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtqty"].Value = "0";
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtbarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvPurchaseReturn.Rows[inI].Cells["dgvcmbBatch"].Value.ToString()));
             dtbl = SPUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
             decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseReturn.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString());
             AmountCalculation("dgvtxtqty", inI);
             dgvPurchaseReturn.Rows[inI].Cells["dgvtxtqty"].Selected = true;
             dgvPurchaseReturn.Rows[inI + 1].Selected = false;
         }
         dgvPurchaseReturn.Rows[inI].HeaderCell.Value = "X";
         dgvPurchaseReturn.Rows[inI].HeaderCell.Style.ForeColor = Color.Red;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:24" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #5
0
        /// <summary>
        /// Get the Product details from the Product creation form
        /// </summary>
        /// <param name="decproductId"></param>
        public void ReturnFromProductCreation(decimal decproductId)
        {
            try
            {
                ProductInfo infoProduct = new ProductInfo();
                ProductSP spProduct = new ProductSP();
                BatchSP spBatch = new BatchSP();
                DataTable dtbl = new DataTable();
                UnitConvertionSP spUnitConversion = new UnitConvertionSP();
                this.Enabled = true;
                this.BringToFront();
                if (decproductId != 0)
                {
                    infoProduct = spProduct.ProductView(decproductId);
                    strProductCode = infoProduct.ProductCode;

                    if (IsdgvConsuption)
                    {
                        int inCurrentRowIndex = dgvConsumption.CurrentRow.Index;
                        dgvConsumption.Rows.Add();
                        ProductDetailsFillConsumption(strProductCode, inCurrentRowIndex, "ProductCode");
                    }

                    else
                    {
                        int inProductionRowIndex = dgvProduction.CurrentRow.Index;
                        dgvProduction.Rows.Add();
                        ProductDetailsFillProduction(strProductCode, inProductionRowIndex, "ProductCode");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SJ:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #6
0
 /// <summary>
 /// Function to fill the details against purchase order
 /// </summary>
 public void FillOrderDetails()
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     ProductSP spproduct = new ProductSP();
     try
     {
         if (!isEditFill)
         {
             isValueChange = false;
             if (dgvProduct.RowCount > 1)
             {
                 for (int i = 0; i < dgvProduct.RowCount - 1; i++)
                 {
                     if (dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value != null && dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString() != string.Empty)
                     {
                         lstArrOfRemove.Add(dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString());
                     }
                 }
             }
             dgvProduct.Rows.Clear();
             isValueChange = true;
             isDoAfterGridFill = false;
             DataTable dtblDetails = new DataTable();
             if (Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()) == decOrderNoWhileEditMode && btnSave.Text == "Update")
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemainingForEdit(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             else
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvProduct.Rows.Add();
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 dgvProduct.CurrentCell = dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"];
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToString(drowDetails.ItemArray[0]);
                 strproductId = drowDetails.ItemArray[2].ToString();
                 ProductInfo infoproduct = new ProductInfo();
                 infoproduct = spproduct.ProductView(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["productId"].Value = Convert.ToDecimal(strproductId);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = infoproduct.ProductName;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvouchertypeId"].Value = Convert.ToString(drowDetails.ItemArray[11]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvoucherNo"].Value = Convert.ToString(drowDetails.ItemArray[12]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtinvoiceNo"].Value = Convert.ToString(drowDetails.ItemArray[13]);
                 UnitComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                 DataTable dtblUnitByProduct = new DataTable();
                 dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId);
                 foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                 {
                     if (dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                     {
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                     }
                 }
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 BatchComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, Convert.ToInt32(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex));
                 decimal decBatch = spStockPosting.BatchViewByProductId(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = decBatch;
                 string strBarcode = spbatch.ProductBatchBarcodeViewByBatchId(decBatch);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = strBarcode;
                 DGVGodownComboFill();
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(1);
                 RackComboFill(1, dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].ColumnIndex);
                 DataTable dtbl = new DataTable();
                 RackSP spRack = new RackSP();
                 dtbl = spRack.RackNamesCorrespondingToGodownId(1);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = Convert.ToString(drowDetails.ItemArray[3]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = Convert.ToString(drowDetails.ItemArray[4]);
                 decCurrentRate = Convert.ToDecimal(drowDetails.ItemArray[4].ToString());
                 decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value.ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = Convert.ToString(drowDetails.ItemArray[6]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["inRowIndex"].Value = Convert.ToString(drowDetails["extra1"]);
                 if (cmbVoucherType.Text != "NA")
                 {
                     dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
                 }
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = string.Empty;
                 int intIndex = 0;
                 int.TryParse(Convert.ToString(drowDetails["extra1"]), out intIndex);
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 NewAmountCalculation(string.Empty, dgvProduct.Rows.Count - 2);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
             }
             for (int i = inRowIndex; i < dgvProduct.Rows.Count; ++i)
                 dgvProduct["inRowIndex", i].Value = Convert.ToString(GetNextinRowIndex());
             SerialNo();
             CalculateTotalAmount();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #7
0
 /// <summary>
 /// Function to calculate total amount
 /// </summary>
 /// <param name="inRowIndex"></param>
 public void Calculate(int inRowIndex)
 {
     decimal decDiscount = 0;
     decimal decDiscountPercent = 0;
     decimal decGrossValue = 0;
     decimal decNetValue = 0;
     decimal decTaxAmount = 0;
     decimal decTaxPercent = 0;
     decimal decTaxId = 0;
     decimal decAmount = 0;
     decimal decTotalAmount = 0;
     decimal decProductId = 0;
     decimal decDefaultTotalAmount = 0;
     decimal decProductRate = 0;
     decimal decQuantity = 0;
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     TaxInfo infotax = new TaxInfo();
     TaxSP spTax = new TaxSP();
     ExchangeRateSP spExchangeRate = new ExchangeRateSP();
     try
     {
         if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value != null)
         {
             if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString() != string.Empty)
             {
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != ".")
                     {
                         decProductRate = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString());
                     }
                 }
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != ".")
                     {
                         decQuantity = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString());
                     }
                 }
                 decGrossValue = decProductRate * decQuantity;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtGrossValue"].Value = Math.Round(decGrossValue, PublicVariables._inNoOfDecimalPlaces);
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString() != string.Empty)
                     {
                         decDiscountPercent = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString());
                     }
                     else
                     {
                         dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                     }
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                 }
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString() != string.Empty)
                     {
                         decDiscount = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString());
                     }
                     else
                     {
                         dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                     }
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                 }
                 /*------------------------------Calculate-----------------------------------*/
                 /*------------------------------Discount Calculation-----------------------------------*/
                 if (decGrossValue >= decDiscount)
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = Math.Round(decDiscount, PublicVariables._inNoOfDecimalPlaces);
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                     decDiscount = 0;
                 }
                 decNetValue = decGrossValue - decDiscount;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtNetValue"].Value = Math.Round(decNetValue, PublicVariables._inNoOfDecimalPlaces);
                 /*------------------------------Tax Calculation-----------------------------------*/
                 if (dgvcmbTax.Visible)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value != null)
                     {
                         if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != string.Empty &&
                             dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != "0")
                         {
                             decTaxId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString());
                             infotax = spTax.TaxView(decTaxId);
                             decTaxPercent = infotax.Rate;
                         }
                         else
                         {
                             decTaxPercent = 0;
                         }
                     }
                     else
                     {
                         decTaxPercent = 0;
                     }
                     decProductId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString());
                     infoProduct = spProduct.ProductView(decProductId);
                     if (infoProduct.TaxapplicableOn == "MRP")
                     {
                         decTaxAmount = infoProduct.Mrp * decTaxPercent / 100;
                     }
                     else
                     {
                         decTaxAmount = decNetValue * decTaxPercent / 100;
                     }
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtTaxAmount"].Value = Math.Round(decTaxAmount, PublicVariables._inNoOfDecimalPlaces);
                 }
                 decAmount = decNetValue + decTaxAmount;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = Math.Round(decAmount, PublicVariables._inNoOfDecimalPlaces);
                 decTotalAmount = decTotalAmount + decAmount;
                 decDefaultTotalAmount = decTotalAmount * 1;
                 //CalculateTotalAmount();
                 //if (dgvTax.Visible)
                 //{
                 //    TotalTaxAmount();
                 //}
                 //CalculateGrandTotal();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI84:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #8
0
 /// <summary>
 /// Function to call frmProductSearchPopup form to select and view a product
 /// </summary>
 /// <param name="frmProductSearchPopup"></param>
 /// <param name="decproductId"></param>
 /// <param name="decCurrentRowIndex"></param>
 public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     try
     {
         base.Show();
         this.frmProductSearchPopupObj = frmProductSearchPopup;
         infoProduct = spProduct.ProductView(decproductId);
         int inRowcount = dgvSalesInvoice.Rows.Count;
         for (int i = 0; i < inRowcount; i++)
         {
             if (i == decCurrentRowIndex)
             {
                 dgvSalesInvoice.Rows.Add();
                 dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = infoProduct.ProductCode;
                 strProductCode = infoProduct.ProductCode;
                 ProductDetailsFill(strProductCode, i, "ProductCode");
             }
         }
         frmProductSearchPopupObj.Close();
         frmProductSearchPopupObj = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 59" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #9
0
        /// <summary>
        /// Function to call frmProductSearch form to select and view product
        /// </summary>
        /// <param name="frmProductSearchPopup"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
        {
            ProductSP spProduct = new ProductSP();
            ProductInfo infoProduct = new ProductInfo();
            try
            {
                base.Show();
                this.frmProductSearchPopupObj = frmProductSearchPopup;
                if (decproductId != 0)
                {
                    int inCurrentRowIndex = dgvProductDetails.CurrentRow.Index;
                    dgvProductDetails.Rows.Add();
                    infoProduct = spProduct.ProductView(decproductId);
                    strProductCode = infoProduct.ProductCode;
                    ProductDetailsFill(strProductCode, inCurrentRowIndex, "ProductCode");
                    SerialNo();
                    frmProductSearchPopupObj.Close();
                    frmProductSearchPopupObj = null;

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PI48:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #10
0
 /// <summary>
 /// Function to fill product Details while return from Product creation when creating new Product 
 /// </summary>
 /// <param name="decProductId"></param>
 public void ReturnFromProductCreation(decimal decProductId)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     try
     {
         this.Enabled = true;
         this.BringToFront();
         if (decProductId != 0)
         {
             int inCurrentRowIndex = dgvProductDetails.CurrentRow.Index;
             dgvProductDetails.Rows.Add();
             infoProduct = spProduct.ProductView(decProductId);
             strProductCode = infoProduct.ProductCode;
             ProductDetailsFill(strProductCode, inCurrentRowIndex, "ProductCode");
             SerialNo();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI59:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #11
0
        /// <summary>
        /// Function to fil Controls based on the barcode
        /// </summary>
        /// <param name="strBarcode"></param>
        public void FillControlsByBarcode(string strBarcode)
        {
            try
            {
                BatchInfo infoBatch = new BatchInfo();
                BatchSP spBatch = new BatchSP();
                PriceListInfo InfoPriceList = new PriceListInfo();
                PriceListSP spPriceList = new PriceListSP();
                infoBatch = spBatch.BatchAndProductViewByBarcode(strBarcode);
                cmbBatch.Text = infoBatch.BatchNo;
                decProductId = infoBatch.ProductId;
                decBatchId = infoBatch.BatchId;
                InfoPriceList = spPriceList.PriceListViewByBatchIdORProduct(decBatchId);
                ProductInfo infoProduct = new ProductInfo();
                ProductSP spProduct = new ProductSP();
                infoProduct = spProduct.ProductView(decProductId);
                txtProductCode.Text = infoProduct.ProductCode;
                string strProductCode = infoProduct.ProductCode;
                isFromBarcode = true;
                cmbItem.Text = infoProduct.ProductName;
                isFromBarcode = false;
                cmbGodown.SelectedValue = infoProduct.GodownId;
                cmbRack.SelectedValue = infoProduct.RackId;
                UnitComboFill();
                UnitInfo infoUnit = new UnitInfo();
                infoUnit = new UnitSP().unitVieWForStandardRate(decProductId);
                cmbUnit.SelectedValue = infoUnit.UnitId;
                if (InfoPriceList.PricinglevelId != 0)
                {
                    cmbPricingLevel.SelectedValue = InfoPriceList.PricinglevelId;
                }
                else
                {
                    cmbPricingLevel.SelectedIndex = 0;
                }
                ComboTaxFill();
                cmbTax.SelectedValue = infoProduct.TaxId;
                if (txtProductCode.Text.Trim() != string.Empty && cmbItem.SelectedIndex != -1)
                {
                    decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
                    decimal dcRate = new ProductSP().ProductRateForSales(decProductId, Convert.ToDateTime(txtDate.Text), decBatchId, decNodecplaces);
                    txtRate.Text = dcRate.ToString();
                    try
                    {
                        if (decimal.Parse(txtQuantity.Text) == 0)
                            txtQuantity.Text = "1";
                    }
                    catch { txtQuantity.Text = "1"; }
                    txtQuantity.Focus();

                }
                else
                {
                    txtRate.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("POS:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #12
0
 /// <summary>
 /// Function to call frmProductSearchPopup form to select and view Products
 /// </summary>
 /// <param name="frmProductSearchPopup"></param>
 /// <param name="decproductId"></param>
 /// <param name="decCurrentRowIndex"></param>
 public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         this.frmProductSearchPopupObj = frmProductSearchPopup;
         infoProduct = spProduct.ProductView(decproductId);
         dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode;
         dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
         dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.PurchaseRate;
         UnitComboFill(decproductId, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex);
         dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
         UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
         dtblunitconversionViewAll = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(infoProduct.ProductCode);
         foreach (DataRow drUnitByProduct in dtblunitconversionViewAll.Rows)
         {
             if (dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
             {
                 dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = drUnitByProduct.ItemArray[2].ToString();
                 dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value = drUnitByProduct.ItemArray[3].ToString();
             }
         }
         decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value.ToString());
         decCurrentRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString());
         NewAmountCalculation("dgvtxtQty", dgvPurchaseOrder.CurrentRow.Index);
         CalculateTotalAmount();
         frmProductSearchPopupObj.Close();
         frmProductSearchPopupObj = null;
         this.Enabled = true;
         this.BringToFront();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #13
0
        /// <summary>
        ///  Function to fill the product details in dataGridView from productCreationPopup
        /// </summary>
        /// <param name="productcreation"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void productDetailsFillFromProductCreation(frmProductCreation productcreation, decimal decproductId, decimal decCurrentRowIndex)
        {
            try
            {
                decimal decCurrentConversionRate = 0;
                DataTable dtbl = new DataTable();
                UnitConvertionSP SPUnitConversion = new UnitConvertionSP();
                BatchSP spBatch = new BatchSP();
                ProductInfo infoProductFill = new ProductInfo();
                ProductSP spproduct = new ProductSP();
                ProductInfo infoProduct = new ProductInfo();
                int inI = dgvProduct.CurrentRow.Index;
                if (inI == dgvProduct.Rows.Count - 1)
                {
                    dgvProduct.Rows.Add();
                }
                  if (decproductId != 0)
                    {
                        infoProduct = spproduct.ProductView(decproductId);
                        SerialNo();
                        dgvProduct.Rows[inI].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode;
                        dgvProduct.Rows[inI].Cells["productId"].Value = decproductId.ToString();
                        dgvProduct.Rows[inI].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
                        dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
                        dgvProduct.Rows[inI].Cells["dgvCmbRack"].Value = infoProduct.RackId;
                        UnitComboFill(decproductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbUnit"].ColumnIndex);
                        dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;

                        UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                        DataTable dtblUnitByProduct = new DataTable();
                        dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[inI].Cells["productId"].Value.ToString());
                        //UnitComboFill(infoProduct.ProductId, dgvProduct.CurrentRow.Index, dgvProduct.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex);
                        //dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
                        dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces);
                        dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionSP().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId));
                        dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value = SPUnitConversion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString()));
                        BatchComboFill(decproductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex);
                        dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decproductId);
                        RackComboFill(infoProduct.GodownId, inI, dgvProduct.Rows[inI].Cells["dgvCmbRack"].ColumnIndex);
                        dgvProduct.Rows[inI].Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString()));
                        dtbl = SPUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
                        dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
                        decCurrentConversionRate = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString());

                        NewAmountCalculation("dgvtxtQty", inI);
                        CalculateTotalAmount();
                    }
                   
                   
            }
            catch (Exception ex)
            {
                MessageBox.Show("MR6:new" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #14
0
        /// <summary>
        /// Function for call from productRegister
        /// </summary>
        public void CallFromProductRegister(decimal decId, frmProductRegister frmProRegister)
        {
            try
            {
                base.Show();

                this.frmProductRegisterObj = frmProRegister;
                frmProductRegisterObj.Enabled = false;

                ProductSP spProduct = new ProductSP();
                ProductInfo infoProduct = new ProductInfo();
                StockPostingInfo infoStockPosting = new StockPostingInfo();
                BatchInfo infoBatch = new BatchInfo();
                StockPostingSP spStockposting = new StockPostingSP();
                BatchSP spBatch = new BatchSP();
                DataTable dtbl = new DataTable();
                UnitSP spUnit = new UnitSP();
                decProductIdForEdit = decId;
                infoProduct = spProduct.ProductView(decId);
                strUnitNameForGrid = spUnit.UnitName(infoProduct.UnitId);
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                //cmbUnit.Enabled = false;
                txtName.Text = infoProduct.ProductName;
                txtProductCode.Text = infoProduct.ProductCode;
                cmbGroup.SelectedValue = infoProduct.GroupId;
                cmbBrand.SelectedValue = infoProduct.BrandId;
                cmbUnit.SelectedValue = infoProduct.UnitId;
                if (spProduct.ProductReferenceCheck(decId))
                {
                    cmbUnit.Enabled = false;
                }

                decUnitIdForUpdate = infoProduct.UnitId;
                cmbSize.SelectedValue = infoProduct.SizeId;
                cmbModalNo.SelectedValue = infoProduct.ModelNoId;
                cmbTax.SelectedValue = infoProduct.TaxId;
                cmbTaxApplicableOn.SelectedItem = infoProduct.TaxapplicableOn;
                txtPurchaseRate.Text = infoProduct.PurchaseRate.ToString();
                txtSalesRate.Text = infoProduct.SalesRate.ToString();
                txtMrp.Text = infoProduct.Mrp.ToString();
                txtMinimumStock.Text = infoProduct.MinimumStock.ToString();
                txtMaximumStock.Text = infoProduct.MaximumStock.ToString();
                txtReorderLevel.Text = infoProduct.ReorderLevel.ToString();
                txtPartNo.Text = infoProduct.PartNo;
                cmbDefaultGodown.SelectedValue = infoProduct.GodownId;
                cmbDefaultRack.SelectedValue = infoProduct.RackId;

                if (infoProduct.IsBom)
                {
                    cmbBom.SelectedIndex = 1;
                    isBomFromRegister = true;
                }
                if (infoProduct.Ismultipleunit)
                {
                    cmbMultipleUnit.SelectedIndex = 1;
                    isMulUnitFromRgister = true;
                }


                if (infoProduct.Isopeningstock)
                {
                    isOpeningStockForUpdate = true;
                    OpeningStockGridFill();

                }

                if (infoProduct.IsallowBatch)
                {
                    OpeningStockGridWithBathFill();
                }
                else
                {
                    cmbAllowBatch.SelectedIndex = 0;
                    txtPartNo.Text = spBatch.PartNoReturn(decProductIdForEdit);
                }
                if (infoProduct.Ismultipleunit)
                {
                    cmbMultipleUnit.SelectedIndex = 1;
                }
                else
                {
                    cmbMultipleUnit.SelectedIndex = 0;
                }

                if (infoProduct.IsBom)
                {
                    cmbBom.SelectedIndex = 1;

                }
                else
                {
                    cmbBom.SelectedIndex = 0;
                }

                if (infoProduct.Isopeningstock)
                {
                    cmbOpeningStock.SelectedIndex = 1;
                }
                else
                {
                    cmbOpeningStock.SelectedIndex = 0;
                }


                if (infoProduct.IsActive)
                {
                    cbxActive.Checked = true;
                }
                else
                {
                    cbxActive.Checked = false;
                }
                if (infoProduct.IsshowRemember)
                {
                    cbxReminder.Checked = true;
                }
                else
                {
                    cbxReminder.Checked = false;
                }
                txtNarration.Text = infoProduct.Narration;


            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:63" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #15
0
 /// <summary>
 /// Function to fill details while return from Product creation when creating new Product 
 /// </summary>
 /// <param name="decProductId"></param>
 public void ReturnFromProductCreation(decimal decProductId)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     BatchSP spBatch = new BatchSP();
     DataTable dtbl = new DataTable();
     UnitConvertionSP spUnitConversion = new UnitConvertionSP();
     try
     {
         this.Enabled = true;
         this.BringToFront();
         if (decProductId != 0)
         {
             infoProduct = spProduct.ProductView(decProductId);
             dgvSalesOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode.ToString();
             dgvSalesOrder.CurrentRow.Cells["dgvtxtProductId"].Value = decProductId.ToString();
             dgvSalesOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
             dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString();
             UnitComboFill(decProductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex);
             dgvSalesOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
             BatchComboFill(decProductId, dgvSalesOrder.CurrentRow.Index, dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].ColumnIndex);
             dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decProductId);
             dgvSalesOrder.CurrentRow.Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvcmbBatch"].Value.ToString()));
             dtbl = spUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
             dgvSalesOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[0]["unitconversionId"].ToString();
             dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
             decCurrentConversionRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString());
             decCurrentRate = Convert.ToDecimal(dgvSalesOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString());
             AmountCalculation("dgvtxtQty", dgvSalesOrder.CurrentRow.Index);
             TotalAmountCalculation();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #16
0
 /// <summary>
 ///Function for ReturnFromProductCreationPopup
 /// </summary>
 public void ReturnFromProductCreation(decimal decProductId)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     BatchSP spBatch = new BatchSP();
     DataTable dtbl = new DataTable();
     UnitConvertionSP spUnitConversion = new UnitConvertionSP();
     try
     {
         this.Enabled = true;
         this.BringToFront();
         int inI = dgvProduct.CurrentRow.Index;
         if (inI == dgvProduct.Rows.Count - 1)
         {
             dgvProduct.Rows.Add();
         }
         if (decProductId != 0)
         {
             infoProduct = spProduct.ProductView(decProductId);
             dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode.ToString();
             dgvProduct.Rows[inI].Cells["dgvtxtProductId"].Value = decProductId.ToString();
             dgvProduct.Rows[inI].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
             dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString();
             UnitComboFill1(decProductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbUnit"].ColumnIndex);
             dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
             BatchComboFill(decProductId, inI, dgvProduct.Rows[inI].Cells["dgvcmbBatch"].ColumnIndex);
             dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decProductId);
             dgvProduct.Rows[inI].Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString()));
             GridGodownComboFill(decProductId, dgvProduct.CurrentRow.Index, dgvProduct.Rows[inI].Cells["dgvcmbGodown"].ColumnIndex);
             dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
             RackComboFill1(infoProduct.GodownId, inI, dgvProduct.Rows[inI].Cells["dgvcmbRack"].ColumnIndex);
             dgvProduct.Rows[inI].Cells["dgvcmbRack"].Value = infoProduct.RackId;
             dtbl = spUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
             dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[0]["unitconversionId"].ToString();
             dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
             decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtConversionRate"].Value.ToString());
             decCurrentRate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
             AmountCalculation("dgvtxtQty", dgvProduct.CurrentRow.Index);
             dgvProduct.Rows[inI].HeaderCell.Value = "X";
             dgvProduct.Rows[inI].HeaderCell.Style.ForeColor = Color.Red;
             TotalAmountCalculation();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #17
0
 /// <summary>
 /// function to get the product rate based on the batch
 /// </summary>
 /// <param name="index"></param>
 /// <param name="decProductId"></param>
 /// <param name="decBatchId"></param>
 public void getProductRate(int index, decimal decProductId, decimal decBatchId)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProdut = new ProductSP();
     decimal decPricingLevelId = 0;
     decimal decRateForPricingLevel = 0;
     try
     {
         DateTime dtcurrentDate = PublicVariables._dtCurrentDate;
         decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
         decPricingLevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
         decRateForPricingLevel = spProdut.SalesInvoiceProductRateForSales(decProductId, dtcurrentDate, decBatchId, decPricingLevelId, decNodecplaces);
         infoProduct = spProdut.ProductView(decProductId);
         dgvSalesReturn.Rows[index].Cells["dgvCmbUnit"].Value = infoProduct.UnitId;
         dgvSalesReturn.Rows[index].Cells["dgvTextRate"].Value = decRateForPricingLevel;
         decRate = decRateForPricingLevel;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR7: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #18
0
 /// <summary>
 /// Function to fill Sales invoice grid while return from Product creation when creating Product 
 /// </summary>
 /// <param name="decProductId"></param>
 public void ReturnFromProductCreation(decimal decProductId)
 {
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     try
     {
         this.Enabled = true;
         this.Activate();
         if (decProductId != 0)
         {
             infoProduct = spProduct.ProductView(decProductId);
             strProductCode = infoProduct.ProductCode;
             ProductDetailsFill(strProductCode, dgvSalesInvoice.CurrentRow.Index, "ProductCode");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 88" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #19
0
        /// <summary>
        /// Function to fill product Details while return from Product creation when creating new Product 
        /// </summary>
        /// <param name="decProductId"></param>
        public void ReturnFromProductCreation(decimal decProductId)
        {
            frmProductCreation productcreation = new frmProductCreation();
            ProductInfo infoProduct = new ProductInfo();
            ProductSP spProduct = new ProductSP();
            try
            {
                int inI = dgvSalesReturn.CurrentRow.Index;
                this.Enabled = true;

                if (decProductId != 0)
                {

                    infoProduct = spProduct.ProductView(decProductId);
                    strProductCode = infoProduct.ProductCode;
                    ProductDetailsFill(strProductCode, inI, "dgvTextProductCode");
                }
                dgvSalesReturn.Focus();

            }
            catch (Exception ex)
            {
                MessageBox.Show("SR8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #20
0
        /// <summary>
        /// Get the Product details from the Product Search form
        /// </summary>
        /// <param name="frmProductSearchPopup"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
        {
            ProductInfo infoProduct = new ProductInfo();
            ProductSP spProduct = new ProductSP();
            BatchSP spBatch = new BatchSP();
            DataTable dtbl = new DataTable();
            UnitConvertionSP spUnitConversion = new UnitConvertionSP();
            try
            {
                base.Show();
                this.frmProductSearchPopupObj = frmProductSearchPopup;
                infoProduct = spProduct.ProductView(decproductId);
                if (IsdgvConsuption)
                {
                    int inRowcount = dgvConsumption.Rows.Count;
                    dgvConsumption.Rows.Add();
                    for (int i = 0; i < inRowcount; i++)
                    {
                        if (i == decCurrentRowIndex)
                        {
                            dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = infoProduct.ProductCode;
                            strProductCode = infoProduct.ProductCode;
                            ProductDetailsFillConsumption(strProductCode, i, "ProductCode");
                        }
                    }
                }
                else
                {
                    int inRowcount = dgvProduction.Rows.Count;
                    dgvProduction.Rows.Add();
                    for (int i = 0; i < inRowcount; i++)
                    {
                        if (i == decCurrentRowIndex)
                        {
                            dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = infoProduct.ProductCode;
                            strProductCode = infoProduct.ProductCode;
                            ProductDetailsFillProduction(strProductCode, i, "ProductCode");
                        }
                    }
                }

                frmProductSearchPopupObj.Close();
                frmProductSearchPopupObj = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("SJ:92" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #21
0
        /// <summary>
        /// To select the product from ProductSearchPopup
        /// </summary>
        /// <param name="frmProductSearchPopup"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
        {
            ProductInfo infoProduct = new ProductInfo();
            ProductSP spproduct = new ProductSP();
            UnitConvertionSP SPUnitConversion = new UnitConvertionSP();
            BatchSP spBatch = new BatchSP();
            try
            {
                base.Show();
                this.frmProductSearchPopupObj = frmProductSearchPopup;
                infoProduct = spproduct.ProductView(decproductId);
                int inRowcount = dgvProduct.Rows.Count;
              
                for (int i = 0; i < inRowcount; i++)
                {
                    if (i == inRowcount - 1)
                    {
                        dgvProduct.Rows.Add();
                    }
                    if (i == decCurrentRowIndex)
                    {
                        SerialNo();
                        dgvProduct.Rows[i].Cells["dgvtxtproductCode"].Value = infoProduct.ProductCode;
                        dgvProduct.Rows[i].Cells["productId"].Value = decproductId.ToString();
                        dgvProduct.Rows[i].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
                        dgvProduct.Rows[i].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
                        dgvProduct.Rows[i].Cells["dgvCmbRack"].Value = infoProduct.RackId;
                        UnitComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbUnit"].ColumnIndex);
                        dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;

                        UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                        DataTable dtblUnitByProduct = new DataTable();
                        dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[i].Cells["productId"].Value.ToString());
                        //UnitComboFill(infoProduct.ProductId, dgvProduct.CurrentRow.Index, dgvProduct.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex);
                        //dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
                        dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces);
                        dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(new UnitConvertionSP().UnitconversionIdViewByUnitIdAndProductId(infoProduct.UnitId, infoProduct.ProductId));
                        dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value = SPUnitConversion.UnitConversionRateByUnitConversionId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value.ToString()));
                        BatchComboFill(decproductId, i, dgvProduct.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
                        dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decproductId);
                        RackComboFill(infoProduct.GodownId, i, dgvProduct.Rows[i].Cells["dgvCmbRack"].ColumnIndex);
                        dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value.ToString()));
                        dtbl = SPUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
                        dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
                        decCurrentConversionRate = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtConversionRate"].Value.ToString());

                        NewAmountCalculation("dgvtxtQty", i);
                        CalculateTotalAmount();
                       
                    }
                }
                frmProductSearchPopupObj.Close();
                frmProductSearchPopupObj = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("MR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }