Пример #1
0
 /// <summary>
 /// Function to view the details of product
 /// </summary>
 /// <param name="decId"></param>
 public void view(decimal decId)
 {
     try
     {
         ProductSP spproduct = new ProductSP();
         DataTable dtbl = spproduct.ProductDetailsForProductSearch(decId);
         foreach (DataRow dr in dtbl.Rows)
         {
             lblProductCode.Text = dr["productCode"].ToString();
             lblProductGroup.Text = dr["groupName"].ToString();
             lblProductName.Text = dr["productName"].ToString();
             lblBrand.Text = dr["brandName"].ToString();
             lblCurrentStock.Text = dr["Currentstock"].ToString();
             lblModelNo.Text = dr["modelNo"].ToString();
             lblSize.Text = dr["size"].ToString();
             lbltax.Text = dr["taxName"].ToString();
             lblUnit.Text = dr["unitName"].ToString();
             lblTaxApplicable.Text = dr["taxapplicableOn"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PD :01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         foreach (DataGridViewRow dgvRow in dgvChangeProductTax.Rows)
         {
             if (dgvRow.Cells["dgvtxtSelect"].Value != null)
             {
                 if ((bool)(dgvRow.Cells["dgvtxtSelect"].Value))
                 {
                     int inProductId = Convert.ToInt32(dgvChangeProductTax.Rows[dgvRow.Index].Cells["dgvtxtProductId"].Value.ToString());
                     ProductSP spProduct = new ProductSP();
                     ProductInfo infoProduct = new ProductInfo();
                     infoProduct.TaxId = Convert.ToInt32(cmbNewTaxType.SelectedValue.ToString());
                     infoProduct.ProductId = inProductId;
                     spProduct.ChangeProductTaxSave(infoProduct);
                     isDefault = false;
                 }
             }
         }
         Messages.SavedMessage();
         cmbSearchBy.Focus();
         Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CPT 2 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         ProductSP spProduct = new ProductSP();
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate = this.dtpToDate.Value;
         dtbl = spProduct.ProductVsBatchReportGridFill(Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), cmbProductCode.Text, Convert.ToDecimal(cmbBatchNo.SelectedValue.ToString()), FromDate, ToDate);
         dgvProductBatch.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show(" PVSBR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         UnitSP spunit = new UnitSP();
         UnitInfo infoUnit = new UnitInfo();
         PriceListSP spPriceList = new PriceListSP();
         PriceListInfo infoPriceList = new PriceListInfo();
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoProduct = spProduct.PriceListPopUpView(decProduct);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decProduct = infoProduct.ProductId;
         decProductMain = infoProduct.ProductId;
         infoUnit = spunit.UnitViewForPriceListPopUp(decProduct);
         decUnitId = infoUnit.UnitId;
         txtUnitName.Text = infoUnit.UnitName;
         decPriceLevelId = infoPriceList.PricinglevelId;
         infoPricingLevel = spPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel = spPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtProductName.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #5
0
 /// <summary>
 /// Function to fill the Product combobox
 /// </summary>
 public void ProductNameComboFill()
 {
     try
     {
         ProductSP spproduct = new ProductSP();
         DataTable dtblProductName = new DataTable();
         dtblProductName = spproduct.ProductViewAllForComboBox();
         DataRow dr = dtblProductName.NewRow();
         dr["ProductName"] = "All";
         dr["ProductId"] = 0;
         dtblProductName.Rows.InsertAt(dr, 0);
         cmbProductName.DataSource = dtblProductName;
         cmbProductName.ValueMember = "productId";
         cmbProductName.DisplayMember = "productName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SER:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
0
 /// <summary>
 /// AutoCompletion of Product name and Product code
 /// </summary>
 /// <param name="isProductName"></param>
 /// <param name="editControl"></param>
 public void FillProducts(bool isProductName, DataGridViewTextBoxEditingControl editControl)
 {
     try
     {
         DataTable dtblProducts = new DataTable();
         dtblProducts = new ProductSP().ProductViewAll();
         ProductNames = new AutoCompleteStringCollection();
         ProductCodes = new AutoCompleteStringCollection();
         foreach (DataRow dr in dtblProducts.Rows)
         {
             ProductNames.Add(dr["productName"].ToString());
             ProductCodes.Add(dr["productCode"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #7
0
        /// <summary>
        /// Function to call frmProductSearchPopup form to select and view Product created 
        /// </summary>
        /// <param name="frmProductSearchPopup"></param>
        /// <param name="decproductId"></param>
        /// <param name="decCurrentRowIndex"></param>
        public void CallFromProductSearchPopup(frmProductSearchPopup frmProductSearchPopup, decimal decproductId, decimal decCurrentRowIndex)
        {
            try
            {
                base.Show();
                this.frmProductSearchPopupObj = frmProductSearchPopup;
                DataTable dtbl = new DataTable();
                UnitConvertionSP spUnitConversion = new UnitConvertionSP();
                ProductInfo infoProduct = new ProductInfo();
                BatchSP spBatch = new BatchSP();
                infoProduct = new ProductSP().ProductView(decproductId);
                dgvProduct.Rows.Add();
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode;
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductId"].Value = decproductId.ToString();
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
                UnitComboFill1(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbUnit"].ColumnIndex);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
                GridGodownComboFill(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbGodown"].ColumnIndex);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
                RackComboFill1(infoProduct.GodownId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbRack"].ColumnIndex);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbRack"].Value = infoProduct.RackId;
                BatchComboFill(decproductId, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index, dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].ColumnIndex);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].Value = spBatch.BatchIdViewByProductId(decproductId);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtBarcode"].Value = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvcmbBatch"].Value.ToString()));
                dtbl = spUnitConversion.DGVUnitConvertionRateByUnitId(infoProduct.UnitId, infoProduct.ProductName);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[0]["unitconversionId"].ToString();
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[0]["conversionRate"].ToString();
                decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtConversionRate"].Value.ToString());
                AmountCalculation("dgvtxtQty", dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Index);
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].Cells["dgvtxtRate"].Value = infoProduct.SalesRate.ToString();
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].HeaderCell.Value = "X";
                dgvProduct.Rows[Convert.ToInt32(decCurrentRowIndex.ToString())].HeaderCell.Style.ForeColor = Color.Red;
                TotalAmountCalculation();
                frmProductSearchPopupObj.Close();
                frmProductSearchPopupObj = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #8
0
 /// <summary>
 /// Fill Product Details Curresponding Product code or Barcode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProduct_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     BatchSP spBatch = new BatchSP();
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         DataTable dtbl = new DataTable();
         isValueChange = false;
         isDoAfterGridFill = false;
         decimal DefaultRate = 0;
         if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtBarcode")
         {
             string strBCode = string.Empty;
             if (!dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].ReadOnly && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString() != string.Empty)
             {
                 strBCode = dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString();
             }
             dtbl = new ProductSP().ProductDetailsCoreespondingToBarcode(strBCode);
             if (dtbl.Rows.Count > 0)
             {
                 foreach (DataRow RowDetails in dtbl.Rows)
                 {
                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductId"].Value = RowDetails["productId"].ToString();
                     decimal decProductId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductId"].Value.ToString());
                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = RowDetails["productCode"].ToString();
                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = RowDetails["productName"].ToString();
                     UnitComboFill1(Convert.ToDecimal(RowDetails["productId"].ToString()), e.RowIndex, dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].ColumnIndex);
                     dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(RowDetails["unitId"].ToString());
                     BatchComboFill(Convert.ToDecimal(RowDetails["productId"].ToString()), e.RowIndex, Convert.ToInt32(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].ColumnIndex));
                     dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(RowDetails["batchId"].ToString());
                     GridGodownComboFill(Convert.ToDecimal(RowDetails["productId"].ToString()), e.RowIndex, dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].ColumnIndex);
                     dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(RowDetails["godownId"].ToString());
                     RackComboFill1(Convert.ToDecimal(RowDetails["godownId"].ToString()), e.RowIndex, dgvProduct.Rows[e.RowIndex].Cells["dgvcmbRack"].ColumnIndex);
                     dgvProduct.Rows[e.RowIndex].Cells["dgvcmbRack"].Value = Convert.ToDecimal(RowDetails["rackId"].ToString());
                     decimal decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString());
                     UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                     DataTable dtblUnitByProduct = new DataTable();
                     dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductId"].Value.ToString());
                     foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                         {
                             dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                             dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                         }
                     }
                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(Convert.ToDecimal(RowDetails["salesRate"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                     decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                     decCurrentRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value.ToString());
                     getProductRate(e.RowIndex, decProductId, decBatchId);
                 }
             }
             else
             {
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductId"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvcmbRack"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;
                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = string.Empty;
             }
         }
         else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtProductCode")
         {
             isValueChange = false;
             isDoAfterGridFill = false;
             ProductDetailsFill(dgvProduct.CurrentRow.Index, "ProductCode");
         }
         else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtProductName")
         {
             isValueChange = false;
             isDoAfterGridFill = false;
             ProductDetailsFill(dgvProduct.CurrentRow.Index, "ProductName");
         }
         else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate")
         {
             if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value != null)
             {
                 if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value.ToString() != string.Empty)
                 {
                     DefaultRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value);
                 }
             }
         }
         AmountCalculation("dgvtxtQty", e.RowIndex);
         TotalAmountCalculation();
         isValueChange = true;
         isDoAfterGridFill = true;
         CheckInvalidEntries(e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN68:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #9
0
 public void ProductDetailsFill(int inRowIndex, string strFillMode)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         BatchSP spBatch = new BatchSP();
         StockPostingSP spStockPosting = new StockPostingSP();
         string strPrdCode = string.Empty;
         string strProductName = string.Empty;
         if (strFillMode == "ProductCode")
         {
             if (dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value as string != string.Empty)
             {
                 strPrdCode = dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value.ToString();
             }
             infoProduct = new ProductSP().ProductViewByCode(strPrdCode);
         }
         if (strFillMode == "ProductName")
         {
             if (dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductName"].Value != null && dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductName"].Value.ToString() != string.Empty)
             {
                 strProductName = dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductName"].Value.ToString();
             }
             infoProduct = new ProductSP().ProductViewByName(strProductName);
         }
         if (infoProduct.ProductId != 0)
         {
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = infoProduct.ProductName;
             string strproductId = Convert.ToString(infoProduct.ProductId);
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId;
             UnitComboFill1(Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtProductId"].Value), inRowIndex, dgvProduct.Rows[inRowIndex].Cells["dgvcmbUnit"].ColumnIndex);
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId;
             BatchComboFill(Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtProductId"].Value), inRowIndex, dgvProduct.Rows[inRowIndex].Cells["dgvcmbBatch"].ColumnIndex);
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = spStockPosting.BatchViewByProductId(Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductId"].Value));
             string strBarcode = spBatch.ProductBatchBarcodeViewByBatchId(Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvcmbBatch"].Value.ToString()));
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = strBarcode;
             GridGodownComboFill(Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvtxtProductId"].Value), inRowIndex, dgvProduct.Rows[inRowIndex].Cells["dgvcmbGodown"].ColumnIndex);
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbGodown"].Value = infoProduct.GodownId;
             RackComboFill1(Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvcmbGodown"].Value), inRowIndex, dgvProduct.Rows[inRowIndex].Cells["dgvcmbRack"].ColumnIndex);
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbRack"].Value = infoProduct.RackId;
             UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
             DataTable dtblUnitByProduct = new DataTable();
             dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId);
             foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
             {
                 if (dgvProduct.Rows[inRowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                 {
                     dgvProduct.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                     dgvProduct.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                 }
             }
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate, PublicVariables._inNoOfDecimalPlaces);
             decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
             decCurrentRate = Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString());
             decimal decProductId = Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString());
             decimal decBatchId = Convert.ToDecimal(dgvProduct.Rows[inRowIndex].Cells["dgvcmbBatch"].Value.ToString());
             getProductRate(inRowIndex, decProductId, decBatchId);
         }
         else
         {
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtRate"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbGodown"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbRack"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtRate"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = string.Empty;
             dgvProduct.Rows[inRowIndex].Cells["dgvtxtQty"].Value = string.Empty;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN47:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #10
0
 /// <summary>
 /// Function to fill the grid to edit the details
 /// </summary>
 public void SalesQuotationDetailsEditFill()
 {
     SalesQuotationDetailsSP SpSalesQuotationDetails = new SalesQuotationDetailsSP();
     SalesQuotationDetailsInfo infoSalesQuotationDetails = new SalesQuotationDetailsInfo();
     ProductSP SpProduct = new ProductSP();
     ProductInfo infoproduct = new ProductInfo();
     try
     {
         for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
         {
             infoSalesQuotationDetails.QuotationMasterId = decSalesquotationMasterId;
             infoSalesQuotationDetails.QuotationDetailsId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQuotationDetailsId"].Value);
             infoproduct = SpProduct.ProductViewByCode(dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
             infoSalesQuotationDetails.ProductId = infoproduct.ProductId;
             infoSalesQuotationDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
             if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQuotationDetailsId"].Value) == 0)
             {
                 infoSalesQuotationDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
             }
             else
             {
                 DGVUnitComboFill();
                 infoSalesQuotationDetails.UnitId = Convert.ToDecimal((dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString()));
             }
             decimal unitConversion = SpSalesQuotationDetails.UnitconversionIdViewByUnitIdAndProductId(infoSalesQuotationDetails.UnitId, infoSalesQuotationDetails.ProductId);
             infoSalesQuotationDetails.UnitConversionId = unitConversion;
             infoSalesQuotationDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value);
             infoSalesQuotationDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value);
             infoSalesQuotationDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value);
             infoSalesQuotationDetails.Slno = Convert.ToInt32(dgvProduct.Rows[inI].Cells["dgvtxtSlNo"].Value);
             infoSalesQuotationDetails.Extra1 = string.Empty;
             infoSalesQuotationDetails.Extra2 = string.Empty;
             SpSalesQuotationDetails.SalesQuotationDetailsEdit(infoSalesQuotationDetails);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
0
 /// <summary>
 /// On selectedindexchange of cmbPricingLevel 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbPricinglevel_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         ProductSP spProduct = new ProductSP();
         foreach (DataGridViewRow dgvrw in dgvProduct.Rows)
         {
             if (dgvrw.Cells["ProductId"].Value != null)
             {
                 DateTime dtcurrentDate = PublicVariables._dtCurrentDate;
                 decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
                 decimal decProductId1 = Convert.ToDecimal(dgvrw.Cells["ProductId"].Value.ToString());
                 if (dgvrw.Cells["dgvcmbBatch"].Value != null)
                 {
                     decimal decStandardRate = spProduct.SalesInvoiceProductRateForSales(decProductId1, dtcurrentDate, Convert.ToDecimal(dgvrw.Cells["dgvcmbBatch"].Value), Convert.ToDecimal(cmbPricinglevel.SelectedValue), decNodecplaces);
                     dgvrw.Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvrw.Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:64" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #12
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);
     }
 }
Пример #13
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);
            }
        }
Пример #14
0
        /// <summary>
        /// Function for save or update
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                ProductSP spProduct = new ProductSP();
                if (txtName.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter product name");
                    txtName.Focus();
                }
                else if (txtProductCode.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter prouct code");
                    txtProductCode.Focus();
                }
                else if (cmbGroup.SelectedIndex == -1)
                {
                    Messages.InformationMessage("Select group");
                    cmbGroup.Focus();
                }
                else if (cmbUnit.SelectedIndex == -1)
                {
                    Messages.InformationMessage(" Select unit");
                    cmbUnit.Focus();
                }
                else if (cmbTaxApplicableOn.SelectedIndex == -1 && cmbTax.SelectedIndex != 0)
                {
                    Messages.InformationMessage("Select tax applicable on");
                    cmbTaxApplicableOn.Focus();
                }
                //else if (txtPartNo.Text.Trim() != string.Empty && spProduct.PartNoCheckExistence(txtPartNo.Text.Trim()) == true)
                //{
                //    Messages.InformationMessage("Part No Already Exist");
                //    txtPartNo.Focus();
                //}
                else
                {
                    if (btnSave.Text == "Save")
                    {

                        if (spProduct.ProductCodeCheckExistence(txtProductCode.Text.Trim(), 0) == false)
                        {
                            if (PublicVariables.isMessageAdd)
                            {
                                if (Messages.SaveMessage())
                                {
                                    SaveFunction();
                                }
                            }
                            else
                            {
                                SaveFunction();
                            }
                        }
                        else
                        {
                            Messages.InformationMessage("Product code already exist");
                            txtProductCode.Focus();
                        }
                    }
                    else
                    {

                        if (spProduct.ProductCodeCheckExistence(txtProductCode.Text.Trim(), decProductIdForEdit) == false)
                        {
                            EditFunction();
                        }
                        else
                        {
                            Messages.InformationMessage("Product code already exist");
                            txtProductCode.Focus();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:62" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #15
0
        /// <summary>
        /// Function for update details in table
        /// </summary>
        public void EditFunction()
        {
            ProductSP spProduct = new ProductSP();
            try
            {
                decimal decStatus = spProduct.BatchReferenceCheckForProductEdit(decProductIdForEdit);
                if (decStatus != 0)
                {
                    if (cmbOpeningStock.SelectedIndex == 1)
                    {

                        if (isOpeningStockChanged)
                        {
                            DeleteOpeningStock();
                            DeleteBatchFromOpeningStock();
                        }

                        if (cmbAllowBatch.SelectedIndex == 0)
                        {


                            if (RemoveIncompleteRowsFromGrid())
                            {
                                if (!GridCheckWeatherSameRackAndGodownExisting())
                                {

                                    ProductEditFill();
                                    if (isUpdated)
                                    {
                                        CheckWetherSaveOrEdit();
                                        RemoveRows();
                                        if (isBatchForUpdate)
                                        {
                                            DeleteBatchFromOpeningStock();
                                        }
                                        if (!isOpeningStockForUpdate)
                                        {
                                            StockPostingTableFillWhileUpdating();
                                        }
                                        else
                                        {
                                            NewRowAdded();
                                            StockPostingTableEditFill();
                                        }

                                        if (isStpUpdated || decCheck > 0 || isRowRemoved)
                                        {
                                            Messages.UpdatedMessage();
                                            this.Close();
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (dgvProductCreation.Rows.Count == 1)
                                {
                                    Messages.InformationMessage("Cant save without atleast one row");
                                    dgvProductCreation.Focus();
                                }



                            }



                        }
                        else
                        {

                            if (RemoveIncompleteRowsFromGrid())
                            {
                                if (!GridCheckWeatherSameRackAndGodownExisting())
                                {

                                    ProductEditFill();
                                    if (isUpdated)
                                    {
                                        CheckWetherSaveOrEdit();
                                        RemoveRows();
                                        if (!isBatchForUpdate)
                                        {
                                            BatchTableFill();
                                        }
                                        else
                                        {
                                            RowsAddInBatchTable();
                                            BatchTableEditFill();
                                        }
                                        if (!isOpeningStockForUpdate)
                                        {
                                            StockPostingTableFillWhileUpdating();
                                        }
                                        else
                                        {
                                            NewRowAdded();
                                            StockPostingTableEditFill();
                                        }


                                        if (isStpUpdated || isBatchUpdated || decBatchId > 0 || decCheck > 0)
                                        {
                                            Messages.UpdatedMessage();
                                            this.Close();
                                        }
                                    }
                                }
                            }


                            else
                            {


                                if (dgvProductCreation.Rows.Count == 1)
                                {
                                    Messages.InformationMessage("Cant save without atleast one row");
                                    dgvProductCreation.Focus();
                                }

                            }

                        }



                    }
                    else
                    {
                        ProductEditFill();

                        CheckWetherSaveOrEdit();


                        if (cmbOpeningStock.SelectedIndex == 0 && isOpeningStockForUpdate == true)
                        {
                            DeleteOpeningStock();
                            if (isBatchForUpdate)
                            {
                                isBatchForUpdate = false;
                                DeleteBatchFromOpeningStock();

                            }
                        }
                        if (cmbAllowBatch.SelectedIndex == 1 && (isBatchForUpdate == true))
                        {
                            DeleteBatchFromOpeningStock();
                        }


                        if (isUpdated)
                        {
                            Messages.UpdatedMessage();
                            this.Close();
                        }

                    }
                }
                else
                {
                    Messages.ReferenceExistsMessageForUpdate();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:61" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


        }
Пример #16
0
        /// <summary>
        /// Function to fill the DtaGridview With Batch While Updating
        /// </summary>
        public void OpeningStockGridWithBathFill()
        {

            try
            {
                DataTable dtbl = new DataTable();
                ProductSP spProduct = new ProductSP();
                BatchSP spBatch = new BatchSP();
                cmbAllowBatch.SelectedIndex = 1;
                isBatchForUpdate = true;

                dtbl = spProduct.ProductViewGridFillFromBatch(decProductIdForEdit);

                for (int i = 0; i < dtbl.Rows.Count; i++)
                {
                    dgvProductCreation.Rows[i].Cells["dgvtxtbatchId"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"]);
                    dgvProductCreation.Rows[i].Cells["dgvtxtExpDate"].Value = dtbl.Rows[i]["expiryDate"];
                    dgvProductCreation.Rows[i].Cells["dgvtxManfDate"].Value = dtbl.Rows[i]["manufacturingDate"];
                    dgvProductCreation.Rows[i].Cells["dgvtxtbatch"].Value = dtbl.Rows[i]["batchNo"];
                }

                foreach (DataGridViewRow dgvRowObj in dgvProductCreation.Rows)
                {
                    if (!dgvRowObj.IsNewRow)
                    {

                        DataGridViewCellEventArgs dgvArg = new DataGridViewCellEventArgs(0, dgvRowObj.Index);
                        CheckingForIncompleteRowInGrid(dgvArg);
                    }
                }
                dgvProductCreation.Focus();
                dgvProductCreation.CurrentCell = dgvProductCreation.Rows[0].Cells[1];
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #17
0
        /// <summary>
        /// Function to fill the datagridview while updating
        /// </summary>
        public void OpeningStockGridFill()
        {
            try
            {
                StockPostingSP spStockposting = new StockPostingSP();
                ProductSP spProduct = new ProductSP();
                DataTable dtbl = new DataTable();
                dtbl = spProduct.ProductViewGridFillFromStockPosting(decProductIdForEdit);

                UnitComboInsideGridFill();
                dgvProductCreation.Rows.Clear();
                for (int i = 0; i < dtbl.Rows.Count; i++)
                {

                    dgvProductCreation.Rows.Add();
                    dgvProductCreation.Rows[i].Cells["dgvtxtstockpostId"].Value = dtbl.Rows[i]["stockPostingId"];
                    dgvProductCreation.Rows[i].Cells["dgvtxtqty"].Value = dtbl.Rows[i]["inwardQty"];
                    dgvProductCreation.Rows[i].Cells["dgvtxtrate"].Value = dtbl.Rows[i]["rate"];
                    dgvProductCreation.Rows[i].Cells["dgvcmbtgodown"].Value = dtbl.Rows[i]["godownId"];
                    dgvProductCreation.Rows[i].Cells["dgvcmbrack"].Value = dtbl.Rows[i]["rackId"];
                    dgvProductCreation.Rows[i].Cells["dgvcmbUnit"].Value = dtbl.Rows[i]["unitId"];


                }

                foreach (DataGridViewRow dgvRowObj in dgvProductCreation.Rows)
                {
                    if (!dgvRowObj.IsNewRow)
                    {

                        DataGridViewCellEventArgs dgvArg = new DataGridViewCellEventArgs(0, dgvRowObj.Index);
                        CheckingForIncompleteRowInGrid(dgvArg);
                    }
                }
                dgvProductCreation.Focus();
                dgvProductCreation.CurrentCell = dgvProductCreation.Rows[0].Cells[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #18
0
        /// <summary>
        /// Function to edit Product table
        /// </summary>
        public void ProductEditFill()
        {

            try
            {
                ProductSP spProduct = new ProductSP();
                ProductInfo infoProduct = new ProductInfo();
                UnitConvertionSP spUnitConvertion = new UnitConvertionSP();
                UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo();
                BatchSP spBatch = new BatchSP();
                infoProduct.ProductName = txtName.Text.Trim();
                infoProduct.ProductCode = txtProductCode.Text.Trim();
                if (txtPurchaseRate.Text.Trim() == string.Empty)
                {
                    infoProduct.PurchaseRate = 0;
                }
                else
                {
                    infoProduct.PurchaseRate = Convert.ToDecimal(txtPurchaseRate.Text.Trim());
                }
                if (txtSalesRate.Text.Trim() == string.Empty)
                {
                    infoProduct.SalesRate = 0;
                }
                else
                {
                    infoProduct.SalesRate = Convert.ToDecimal(txtSalesRate.Text.Trim());
                }
                if (txtMrp.Text.Trim() == string.Empty)
                {
                    infoProduct.Mrp = 0;
                }
                else
                {
                    infoProduct.Mrp = Convert.ToDecimal(txtMrp.Text);
                }

                infoProduct.MaximumStock = Convert.ToDecimal(txtMaximumStock.Text.Trim());
                infoProduct.MinimumStock = Convert.ToDecimal(txtMinimumStock.Text.Trim());
                infoProduct.ReorderLevel = Convert.ToDecimal(txtReorderLevel.Text.Trim());
                infoProduct.Extra1 = string.Empty;
                infoProduct.Extra2 = string.Empty;
                infoProduct.ExtraDate = DateTime.Now;
                infoProduct.TaxId = Convert.ToDecimal(cmbTax.SelectedValue);
                infoProduct.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
                infoProduct.GroupId = Convert.ToDecimal(cmbGroup.SelectedValue);
                infoProduct.Narration = txtNarration.Text;

                infoProduct.ProductId = decProductIdForEdit;
                infoUnitConvertion.ProductId = decProductIdForEdit;
                infoUnitConvertion.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
                if (cmbTax.SelectedIndex == 0)
                {
                    infoProduct.TaxapplicableOn = string.Empty;
                }
                else
                {
                    infoProduct.TaxapplicableOn = Convert.ToString(cmbTaxApplicableOn.SelectedItem);
                }
                if (cmbBrand.SelectedIndex != -1)
                {
                    infoProduct.BrandId = Convert.ToDecimal(cmbBrand.SelectedValue);
                }
                else
                {
                    infoProduct.BrandId = 1;
                }
                if (cmbSize.SelectedIndex != -1)
                {
                    infoProduct.SizeId = Convert.ToDecimal(cmbSize.SelectedValue);
                }
                else
                {
                    infoProduct.SizeId = 1;
                }
                if (cmbModalNo.SelectedIndex != -1)
                {
                    infoProduct.ModelNoId = Convert.ToDecimal(cmbModalNo.SelectedValue);
                }
                else
                {
                    infoProduct.ModelNoId = 1;
                }
                if (cmbDefaultGodown.SelectedIndex != -1)
                {
                    infoProduct.GodownId = Convert.ToDecimal(cmbDefaultGodown.SelectedValue);
                }
                else
                {
                    infoProduct.GodownId = 1;
                }
                if (cmbDefaultRack.SelectedIndex != -1)
                {
                    infoProduct.RackId = Convert.ToDecimal(cmbDefaultRack.SelectedValue);
                }
                else
                {
                    infoProduct.RackId = 1;
                }
                if (cmbAllowBatch.SelectedIndex == 0)
                {
                    infoProduct.IsallowBatch = false;
                    spBatch.PartNoUpdate(decProductIdForEdit, txtPartNo.Text.Trim());

                }
                else
                {
                    infoProduct.IsallowBatch = true;
                }
                if (cmbBom.SelectedIndex == 0)
                {
                    infoProduct.IsBom = false;
                }
                else
                {
                    if (isSaveBomCheck || isBomFromRegister)
                    {
                        infoProduct.IsBom = true;
                    }
                    else
                    {
                        infoProduct.IsBom = false;
                    }

                }

                if (cmbMultipleUnit.SelectedIndex == 0)
                {

                    infoProduct.Ismultipleunit = false;
                }
                else
                {
                    if ((isMulUnitFromRgister || isSaveMulUnitCheck))
                    {
                        infoProduct.Ismultipleunit = true;

                    }
                    else
                    {
                        infoProduct.Ismultipleunit = false;
                    }

                }
                if (cbxActive.Checked)
                {
                    infoProduct.IsActive = true;
                }
                else
                {
                    infoProduct.IsActive = false;
                }
                if (cbxReminder.Checked)
                {
                    infoProduct.IsshowRemember = true;
                }
                else
                {
                    infoProduct.IsshowRemember = false;
                }
                if (cmbOpeningStock.SelectedIndex == 0)
                {
                    infoProduct.Isopeningstock = false;
                }
                else
                {
                    infoProduct.Isopeningstock = true;
                }

                if (PublicVariables.isMessageEdit)
                {
                    if (Messages.UpdateMessage())
                    {
                        isUpdated = spProduct.ProductEdit(infoProduct);
                        spUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion);
                    }
                }
                else
                {
                    isUpdated = spProduct.ProductEdit(infoProduct);
                    spUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #19
0
        /// <summary>
        /// Function to save data to product table
        /// </summary>
        public void ProductTableFill()
        {

            try
            {
                ProductSP spProduct = new ProductSP();
                ProductInfo infoProduct = new ProductInfo();
                UnitConvertionSP spUnitConvertion = new UnitConvertionSP();
                UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo();
                infoProduct.ProductName = txtName.Text.Trim();
                infoProduct.ProductCode = txtProductCode.Text.Trim();
                if (txtPurchaseRate.Text != string.Empty)
                {
                    infoProduct.PurchaseRate = Convert.ToDecimal(txtPurchaseRate.Text.Trim());
                }
                else
                {
                    infoProduct.PurchaseRate = 0;
                }
                if (txtSalesRate.Text != string.Empty)
                {
                    infoProduct.SalesRate = Convert.ToDecimal(txtSalesRate.Text.Trim());
                }
                else
                {
                    infoProduct.SalesRate = 0;
                }
                if (txtMrp.Text != string.Empty)
                {
                    infoProduct.Mrp = Convert.ToDecimal(txtMrp.Text.Trim());
                }
                else
                {
                    infoProduct.Mrp = 0;
                }
                infoProduct.MaximumStock = Convert.ToDecimal(txtMaximumStock.Text.Trim());
                infoProduct.MinimumStock = Convert.ToDecimal(txtMinimumStock.Text.Trim());
                infoProduct.ReorderLevel = Convert.ToDecimal(txtReorderLevel.Text.Trim());
                infoProduct.Extra1 = string.Empty;
                infoProduct.Extra2 = string.Empty;
                infoProduct.ExtraDate = DateTime.Now;
                infoProduct.TaxId = Convert.ToDecimal(cmbTax.SelectedValue);
                infoProduct.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
                infoProduct.GroupId = Convert.ToDecimal(cmbGroup.SelectedValue);
                infoProduct.Narration = txtNarration.Text;

                infoUnitConvertion.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
                infoUnitConvertion.ConversionRate = 1;
                infoUnitConvertion.Quantities = string.Empty;
                infoUnitConvertion.Extra1 = string.Empty;

                infoUnitConvertion.Extra2 = string.Empty;
                infoUnitConvertion.ExtraDate = DateTime.Now;

                if (cmbTax.SelectedIndex == 0)
                {
                    infoProduct.TaxapplicableOn = "Rate";
                }
                else
                {
                    infoProduct.TaxapplicableOn = Convert.ToString(cmbTaxApplicableOn.SelectedItem);
                }
                if (cmbBrand.SelectedIndex != -1)
                {
                    infoProduct.BrandId = Convert.ToDecimal(cmbBrand.SelectedValue);
                }
                else
                {
                    infoProduct.BrandId = 1;
                }
                if (cmbSize.SelectedIndex != -1)
                {
                    infoProduct.SizeId = Convert.ToDecimal(cmbSize.SelectedValue);
                }
                else
                {
                    infoProduct.SizeId = 1;
                }
                if (cmbModalNo.SelectedIndex != -1)
                {
                    infoProduct.ModelNoId = Convert.ToDecimal(cmbModalNo.SelectedValue);
                }
                else
                {
                    infoProduct.ModelNoId = 1;
                }
                if (cmbDefaultGodown.SelectedIndex != -1)
                {
                    infoProduct.GodownId = Convert.ToDecimal(cmbDefaultGodown.SelectedValue);
                }
                else
                {
                    infoProduct.GodownId = 1;
                }
                if (cmbDefaultRack.SelectedIndex != -1)
                {
                    infoProduct.RackId = Convert.ToDecimal(cmbDefaultRack.SelectedValue);
                }
                else
                {
                    infoProduct.RackId = 1;
                }
                if (cmbAllowBatch.SelectedIndex == 0)
                {
                    infoProduct.IsallowBatch = false;
                }
                else
                {
                    infoProduct.IsallowBatch = true;
                }
                if (cmbBom.SelectedIndex == 0)
                {
                    infoProduct.IsBom = false;
                }
                else
                {
                    if (isSaveBomCheck)
                    {
                        infoProduct.IsBom = true;
                    }
                    else
                    {
                        infoProduct.IsBom = false;
                    }

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

                }
                else
                {
                    infoProduct.Isopeningstock = true;
                    infoProduct.PurchaseRate = Convert.ToDecimal(dgvProductCreation.Rows[0].Cells["dgvtxtrate"].Value);
                }
                if (cmbMultipleUnit.SelectedIndex == 0)
                {

                    infoProduct.Ismultipleunit = false;
                }
                else
                {
                    if (isSaveMulUnitCheck)
                    {
                        infoProduct.Ismultipleunit = true;

                    }
                    else
                    {
                        infoProduct.Ismultipleunit = false;
                    }

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

                decSaveProduct = spProduct.ProductAdd(infoProduct);
                infoUnitConvertion.ProductId = decSaveProduct;
                spUnitConvertion.UnitConvertionAdd(infoUnitConvertion);

            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:24" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


        }
Пример #20
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);
     }
 }
Пример #21
0
 /// <summary>
 /// Getting the product rate based on the product, in the product coming under the offer or pricing level
 /// </summary>
 /// <param name="index"></param>
 /// <param name="decProductId"></param>
 /// <param name="decBatchId"></param>
 public void getProductRate(int index, decimal decProductId, decimal decBatchId)
 {
     ProductSP spProduct = new ProductSP();
     decimal decPricingLevelId = 0;
     try
     {
         DateTime dtcurrentDate = PublicVariables._dtCurrentDate;
         decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
         decPricingLevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
         decimal decRate = spProduct.SalesInvoiceProductRateForSales(decProductId, dtcurrentDate, decBatchId, decPricingLevelId, decNodecplaces);
         dgvSalesInvoice.Rows[index].Cells["dgvtxtSalesInvoiceRate"].Value = decRate;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 35 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #22
0
        /// <summary>
        /// Function to fill the grid based on the search keys
        /// </summary>
        public void GridFill()
        {
            try
            {
                string strComboText = string.Empty;
                DataTable dtbl = new DataTable();
                ProductSP spProduct = new ProductSP();
                ProductInfo infoProduct = new ProductInfo();
                if (cmbActive.Text == "Yes")
                {
                    strComboText = "True";
                }
                else if (cmbActive.Text == "No")
                {
                    strComboText = "False";
                }
                else
                {
                    cmbActive.SelectedIndex = 0;
                    strComboText = "All";
                }
                if (txtSalesRateFrom.Text == string.Empty && txtSalesRateTo.Text == string.Empty)
                {
                    txtSalesRateFrom.Text = "0";
                    txtSalesRateTo.Text = "0";
                }
                decimal decProductGroup = Convert.ToDecimal(cmbProductGroup.SelectedValue);
                string strProductName = txtProductName.Text.Trim();
                string strProductCode = txtProductCode.Text.Trim();
                decimal decSize = Convert.ToDecimal(cmbSize.SelectedValue);
                decimal decModelNo = Convert.ToDecimal(cmbModelNo.SelectedValue);
                decimal decBrand = Convert.ToDecimal(cmbBrand.SelectedValue);
                decimal decTax = Convert.ToDecimal(cmbTax.SelectedValue);
                string strTaxApplicable = cmbTaxApplicableOn.Text.Trim();
                decimal decSalesRateFrom = Convert.ToDecimal(txtSalesRateFrom.Text);
                decimal decSalesRateTo = Convert.ToDecimal(txtSalesRateTo.Text);

                dtbl = spProduct.ProductRegisterSearch(decProductGroup, strProductName, strProductCode, decSize, decModelNo, decBrand, decTax, strTaxApplicable, decSalesRateFrom, decSalesRateTo, strComboText);

                dgvProductRegister.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                MessageBox.Show("PR7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #23
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);
     }
 }
Пример #24
0
 /// <summary>
 /// Function for auto completion of products
 /// </summary>
 public void AutoCompleteProducts()
 {
     ProductSP spProduct = new ProductSP();
     try
     {
         DataTable dtblProducts = new DataTable();
         dtblProducts = spProduct.ProductViewAll();
         ProductNames = new AutoCompleteStringCollection();
         ProductCodes = new AutoCompleteStringCollection();
         foreach (DataRow dr in dtblProducts.Rows)
         {
             ProductNames.Add(dr["productName"].ToString());
             ProductCodes.Add(dr["productCode"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:44" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #25
0
        /// <summary>
        /// Function for delete data from tbl_Product
        /// </summary>
        public void Delete()
        {
            try
            {
                ProductSP spProduct = new ProductSP();
                decimal decResult = spProduct.DeleteProductWithReferenceCheck(decProductIdForEdit);
                if (decResult > 0)
                {
                    Messages.DeletedMessage();
                    ClearFunction();
                    this.Close();
                }
                else
                {
                    Messages.ReferenceExistsMessage();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:66" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #26
0
        private void dgvProduct_CellLeave(object sender, DataGridViewCellEventArgs e)
        {
            try
            {

                if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtQty")
                {
                    if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQuotationDetailsId"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQuotationDetailsId"].Value.ToString() != string.Empty && Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQuotationDetailsId"].Value.ToString()) != 0)
                    {
                        if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString() != string.Empty)
                        {
                            SalesQuotationDetailsSP spSalesQuationDetails = new SalesQuotationDetailsSP();
                            decimal decReferencedQty = Math.Round(spSalesQuationDetails.SalesQuatationReferenceCheck(Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQuotationDetailsId"].Value.ToString())),PublicVariables._inNoOfDecimalPlaces);
                            decimal decQty = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString());
                            if (decQty < decReferencedQty)
                            {
                                Messages.InformationMessage("Quantity in row " + (e.RowIndex + 1) + " should be greater than " + decReferencedQty);
                                IsCellValue = false;
                                dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = Math.Round(decReferencedQty,PublicVariables._inNoOfDecimalPlaces);
                                IsCellValue = true;
                            }
                        }
                    }
                    AmountCalculation("dgvtxtQty", e.RowIndex);
                    TotalAmountCalculation();
                }
                else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbUnit")
                {
                    if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                    {
                        UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                        DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value.ToString());
                        if (dtblUnitByProduct.Rows.Count > 0)
                        {
                            foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                            {
                                if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                                {
                                    dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                                    dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                                    if (IsDoAfterFill)
                                    {
                                        decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                                        decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate;
                                        dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, Convert.ToInt32(PublicVariables._inNoOfDecimalPlaces));
                                    }
                                }
                            }
                            AmountCalculation("dgvtxtQty", e.RowIndex);
                            TotalAmountCalculation();
                        }
                    }
                }
                else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbBatch")
                {
                    if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                    {
                        string strProductCode = string.Empty;
                        ProductInfo infoproduct = new ProductInfo();
                        ProductSP SpProduct = new ProductSP();
                        decimal decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value);
                        dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = SpProduct.BarcodeViewByBatchId(decBatchId);
                        strProductCode = dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString();
                        infoproduct = SpProduct.ProductViewByCode(strProductCode);
                        DateTime dtcurrentDate = PublicVariables._dtCurrentDate;
                        decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces;
                        decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(infoproduct.ProductId, dtcurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), decNodecplaces);
                        if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty)
                        {
                            if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value) != 0)
                            {
                                dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces);
                            }
                            AmountCalculation("dgvtxtQty", e.RowIndex);
                            TotalAmountCalculation();
                        }
                    }
                }
                else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtExchangeRate" && isAmountcalc)
                {
                    AmountCalculation("dgvtxtExchangeRate", e.RowIndex);
                    TotalAmountCalculation();
                }
                //---------------while changing Rate,corresponding change in amount----
                else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate" && isAmountcalc)
                {
                    AmountCalculation("dgvtxtRate", e.RowIndex);
                    TotalAmountCalculation();
                }
                //----while changing amount ,corresponding chnage in total amount-------
                
                CheckInvalidEntriesInDataGridProduct(e);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SQ:76" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #27
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);
            }
        }
Пример #28
0
        /// <summary>
        /// Function to generate Product code automatically
        /// </summary>
        public void AutomaticCodeGenaration()
        {

            try
            {

                if (AutomaticProductCode())
                {

                    ProductSP spProduct = new ProductSP();
                    string strPcode = spProduct.ProductMax();
                    //int inCode = strPcode.Length;
                    //if (inCode == 3)
                    //{
                    //    strPcode = (strPcode.ToString()).PadLeft(4, '0');
                    //}
                    //else if (inCode == 2)
                    //{
                    //    strPcode = (strPcode.ToString()).PadLeft(4, '0');
                    //}
                    //else
                    //{
                    //    strPcode = (strPcode.ToString());
                    //}
                    txtProductCode.Text = strPcode;
                    txtProductCode.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #29
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);
            }
        }
Пример #30
0
        /// <summary>
        /// Function to get the Details
        /// </summary>
        public void DeliveryNoteDetails()
        {
            try
            {
                ProductInfo infoProduct = new ProductInfo();
                ProductSP spProduct = new ProductSP();
                DeliveryNoteDetailsInfo infoDeliveryNoteDetails = new DeliveryNoteDetailsInfo();
                StockPostingInfo infoStockPosting = new StockPostingInfo();
                StockPostingSP spStockPosting = new StockPostingSP();
                DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
                UnitSP spUnit = new UnitSP();

                for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
                {
                    if (dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value == null)
                    {
                        if (cmbDeliveryMode.Text == "Against Order")
                        {
                            if (dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value != null)
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value == null ? string.Empty : dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                            }
                            else
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                            }
                        }
                        else if (cmbDeliveryMode.Text == "Against Quotation")
                        {
                            if (dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value != null)
                            {
                                infoDeliveryNoteDetails.QuotationDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value == null ? string.Empty : dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                            }
                            else
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                            }
                        }
                        else if (cmbDeliveryMode.Text == "NA")
                        {
                            infoDeliveryNoteDetails.OrderDetails1Id = 0;
                            infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                        }
                    }
                    else
                    {
                        if (dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value != null)
                        {
                            if (cmbDeliveryMode.Text == "Against Order")
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                            }
                            else if (cmbDeliveryMode.Text == "Against Quotation")
                            {
                                infoDeliveryNoteDetails.QuotationDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                            }
                            else if (cmbDeliveryMode.Text == "NA")
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                            }
                        }
                        else
                        {
                            infoDeliveryNoteDetails.OrderDetails1Id = 0;
                            infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                        }
                    }
                    if (dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value == null || dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value.ToString() == string.Empty || Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value) == 0)
                    {
                        infoDeliveryNoteDetails.DeliveryNoteMasterId = decDelivryNoteIdToEdit;
                        infoProduct = spProduct.ProductViewByCode(dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                        infoDeliveryNoteDetails.ProductId = infoProduct.ProductId;
                        infoDeliveryNoteDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                        infoDeliveryNoteDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value);
                        infoDeliveryNoteDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString());
                        infoDeliveryNoteDetails.GodownId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value.ToString());
                        infoDeliveryNoteDetails.RackId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbRack"].Value.ToString());
                        infoDeliveryNoteDetails.UnitConversionId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString());
                        infoDeliveryNoteDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                        infoDeliveryNoteDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                        infoDeliveryNoteDetails.SlNo = Convert.ToInt32(dgvProduct.Rows[inI].Cells["Col"].Value.ToString());
                        infoDeliveryNoteDetails.Extra1 = string.Empty;
                        infoDeliveryNoteDetails.Extra2 = string.Empty;
                        spDeliveryNoteDetails.DeliveryNoteDetailsAdd(infoDeliveryNoteDetails);
                    }
                    else
                    {
                        infoDeliveryNoteDetails.DeliveryNoteMasterId = decDelivryNoteIdToEdit;
                        infoDeliveryNoteDetails.DeliveryNoteDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value);
                        infoProduct = spProduct.ProductViewByCode(dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                        infoDeliveryNoteDetails.ProductId = infoProduct.ProductId;
                        infoDeliveryNoteDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());

                        if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value) == 0)
                        {
                            infoDeliveryNoteDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                        }
                        else
                        {
                            infoDeliveryNoteDetails.UnitId = Convert.ToDecimal(spUnit.UnitIdByUnitName(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].FormattedValue.ToString()));
                        }
                        infoDeliveryNoteDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString());
                        infoDeliveryNoteDetails.GodownId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value.ToString());
                        infoDeliveryNoteDetails.RackId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbRack"].Value.ToString());
                        infoDeliveryNoteDetails.UnitConversionId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString());
                        infoDeliveryNoteDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                        infoDeliveryNoteDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                        infoDeliveryNoteDetails.SlNo = Convert.ToInt32(dgvProduct.Rows[inI].Cells["Col"].Value.ToString());
                        spDeliveryNoteDetails.DeliveryNoteDetailsEdit(infoDeliveryNoteDetails);
                    }
                    infoStockPosting.Date = Convert.ToDateTime(txtDate.Text);
                    if (Convert.ToInt32(dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value) != 0)
                    {
                        if (cmbDeliveryMode.SelectedItem.ToString() != "NA")
                        {
                            if (dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value != null)
                            {
                                infoStockPosting.VoucherTypeId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value);
                            }
                            else
                            {
                                infoStockPosting.VoucherTypeId = 0;
                            }
                            if (dgvProduct.Rows[inI].Cells["dgvtxtVoucherNo"].Value != null)
                            {
                                infoStockPosting.VoucherNo = dgvProduct.Rows[inI].Cells["dgvtxtVoucherNo"].Value.ToString();
                            }
                            else
                            {
                                infoStockPosting.VoucherNo = string.Empty;
                            }
                            if (dgvProduct.Rows[inI].Cells["dgvtxtInvoiceNo"].Value != null)
                            {
                                infoStockPosting.InvoiceNo = dgvProduct.Rows[inI].Cells["dgvtxtInvoiceNo"].Value.ToString();
                            }
                            else
                            {
                                infoStockPosting.InvoiceNo = string.Empty;
                            }
                            if (decDeliveryNoteVoucherTypeId != 0)
                            {
                                infoStockPosting.AgainstVoucherTypeId = decDeliveryNoteVoucherTypeId;
                            }
                            else
                            {
                                infoStockPosting.AgainstVoucherTypeId = 0;
                            }
                            if (strVoucherNo != string.Empty)
                            {
                                infoStockPosting.AgainstVoucherNo = strVoucherNo;
                            }
                            else
                            {
                                infoStockPosting.AgainstVoucherNo = string.Empty;
                            }
                            if (txtDeliveryNoteNo.Text != string.Empty)
                            {
                                infoStockPosting.AgainstInvoiceNo = txtDeliveryNoteNo.Text;
                            }
                            else
                            {
                                infoStockPosting.AgainstInvoiceNo = string.Empty;
                            }
                        }
                    }
                    else
                    {
                        infoStockPosting.InvoiceNo = txtDeliveryNoteNo.Text;
                        infoStockPosting.VoucherNo = strVoucherNo;
                        infoStockPosting.VoucherTypeId = decDeliveryNoteVoucherTypeId;
                        infoStockPosting.AgainstVoucherTypeId = 0;
                        infoStockPosting.AgainstVoucherNo = "NA";
                        infoStockPosting.AgainstInvoiceNo = "NA";
                    }
                    infoStockPosting.ProductId = infoDeliveryNoteDetails.ProductId;
                    infoStockPosting.BatchId = infoDeliveryNoteDetails.BatchId;
                    infoStockPosting.UnitId = infoDeliveryNoteDetails.UnitId;
                    infoStockPosting.GodownId = infoDeliveryNoteDetails.GodownId;
                    infoStockPosting.RackId = infoDeliveryNoteDetails.RackId;
                    infoStockPosting.OutwardQty = infoDeliveryNoteDetails.Qty;
                    infoStockPosting.Rate = infoDeliveryNoteDetails.Rate;
                    infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                    infoStockPosting.Extra1 = string.Empty;
                    infoStockPosting.Extra2 = string.Empty;
                    spStockPosting.StockPostingAdd(infoStockPosting);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }