Beispiel #1
0
 /// <summary>
 /// Print button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click_1(object sender, EventArgs e)
 {
     try
     {
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         if (dgvPhysicalStockReport.RowCount > 0)
         {
             DataSet   ds                      = new DataSet();
             CompanySP spCompany               = new CompanySP();
             frmReport reportobj               = new frmReport();
             DataTable dtblCompany             = spCompany.CompanyViewDataTable(1);
             DataTable dtblPhysicalStockReport = spPhysicalStockMaster.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue));
             ds.Tables.Add(dtblCompany);
             ds.Tables.Add(dtblPhysicalStockReport);
             reportobj.MdiParent = formMDI.MDIObj;
             reportobj.PhysicalStockReport(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PSRT6:" + ex.Message;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Function to fill the grid based on the search condition
        /// </summary>
        public void gridfill()
        {
            try
            {
                PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();


                DataTable dtbl = new DataTable();
                dtbl = spPhysicalStockMaster.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue));
                dgvPhysicalStockReport.DataSource = dtbl;
                if (dgvPhysicalStockReport.Columns.Count > 0)
                {
                    dgvPhysicalStockReport.Columns["dgvtxtpurchaseRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    dgvPhysicalStockReport.Columns["dgvtxtsalesRate"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    dgvPhysicalStockReport.Columns["dgvtxtmrp"].DefaultCellStyle.Alignment          = DataGridViewContentAlignment.MiddleRight;
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "PSRT1:" + ex.Message;
            }
        }
 /// <summary>
 /// Print function for crystel report
 /// </summary>
 /// <param name="decPhysicalStockMasterId"></param>
 public void Print(decimal decPhysicalStockMasterId)
 {
     try
     {
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         DataSet dsPhysicalStock = spPhysicalStockMaster.PhysicalStockPrinting(decPhysicalStockMasterId, 1);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PhysicalStockPrinting(dsPhysicalStock);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Edit function
        /// </summary>
        public void EditFunction()
        {
            try
            {

                PhysicalStockDetailsSP spPhysicalStockDetails = new PhysicalStockDetailsSP();
                PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
                infoPhysicalStockMaster.PhysicalStockMasterId = decMasterId;
                infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text.Trim();
                infoPhysicalStockMaster.Date = Convert.ToDateTime(txtDate.Text);
                infoPhysicalStockMaster.Narration = txtNarration.Text.Trim();
                infoPhysicalStockMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
                if (!isAutomatic)
                {
                    infoPhysicalStockMaster.SuffixPrefixId = decPhysicalStockSuffixPrefixId;
                    infoPhysicalStockMaster.VoucherNo = strVoucherNo;
                }
                else
                {
                    infoPhysicalStockMaster.SuffixPrefixId = 0;
                    infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text;
                }
                infoPhysicalStockMaster.VoucherTypeId = decPhysicalStockVoucherTypeId;
                infoPhysicalStockMaster.InvoiceNo = txtVoucherNo.Text;
                infoPhysicalStockMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                infoPhysicalStockMaster.Extra1 = string.Empty;
                infoPhysicalStockMaster.Extra2 = string.Empty;
                infoPhysicalStockMaster.ExtraDate = DateTime.Now;
                spPhysicalStockMaster.PhysicalStockMasterEdit(infoPhysicalStockMaster);
                spPhysicalStockDetails.PhysicalStockDetailsDeleteWhenUpdate(decMasterId);
                EditPhysicalStockDetails();
                Messages.UpdatedMessage();
                if (frmPhysicalStockRegisterObj != null)
                {
                    if (cbxPrint.Checked)
                    {
                        if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decMasterId);
                        }
                        else
                        {
                            Print(decMasterId);
                        }
                    }
                    this.Close();
                    frmPhysicalStockRegisterObj.gridfill();
                }
                if (frmPhysicalStockReportObj != null)
                {
                    if (cbxPrint.Checked)
                    {
                        if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decMasterId);
                        }
                        else
                        {
                            Print(decMasterId);
                        }
                    }
                    this.Close();
                    frmPhysicalStockReportObj.gridfill();
                }
                if (frmDayBookObj != null)
                {
                    if (cbxPrint.Checked)
                    {
                        if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decMasterId);
                        }
                        else
                        {
                            Print(decMasterId);
                        }
                    }
                    this.Close();
                    frmDayBookObj.dayBookGridFill();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Voucher no generation function based on settings
 /// </summary>
 public void VoucherNumberGeneration()
 {
     try
     {
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         if (strVoucherNo == string.Empty)
         {
             strVoucherNo = "0";
         }
         strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
         if (Convert.ToDecimal(strVoucherNo) != (spPhysicalStockMaster.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId)))
         {
             strVoucherNo = spPhysicalStockMaster.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId).ToString();
             strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
             if (spPhysicalStockMaster.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId) == 0)
             {
                 strVoucherNo = "0";
                 strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
             }
         }
         if (isAutomatic)
         {
             SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
             SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
             infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPhysicalStockVoucherTypeId, dtpDate.Value);
             strPrefix = infoSuffixPrefix.Prefix;
             strSuffix = infoSuffixPrefix.Suffix;
             decPhysicalStockSuffixPrefixId = infoSuffixPrefix.SuffixprefixId;
             txtVoucherNo.Text = strPrefix + strVoucherNo + strSuffix;
             txtVoucherNo.ReadOnly = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:18" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Fill function for updation
        /// </summary>
        public void FillFunction()
        {
            try
            {
                PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo();
                PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                infoPhysicalStockMaster = spPhysicalStockMaster.PhysicalStockMasterView(decMasterId);
                txtVoucherNo.Text = infoPhysicalStockMaster.InvoiceNo;
                strVoucherNo = infoPhysicalStockMaster.VoucherNo.ToString();
                decPhysicalStockSuffixPrefixId = Convert.ToDecimal(infoPhysicalStockMaster.SuffixPrefixId);
                decPhysicalStockVoucherTypeId = Convert.ToDecimal(infoPhysicalStockMaster.VoucherTypeId);
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId);
                txtDate.Text = infoPhysicalStockMaster.Date.ToString("dd-MMM-yyyy");
                txtNarration.Text = infoPhysicalStockMaster.Narration;
                txtTotalAmount.Text = infoPhysicalStockMaster.TotalAmount.ToString();
                DataTable dtbl = new DataTable();
                dtbl = spPhysicalStockMaster.PhysicalStockViewbyMasterId(decMasterId);
                isFromEditMode = true;
                for (int i = 0; i < dtbl.Rows.Count; i++)
                {

                    dgvPhysicalStock.Rows.Add();
                    dgvPhysicalStock.Rows[i].HeaderCell.Value = string.Empty;
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtPhysicalStockDetailId"].Value = Convert.ToDecimal(dtbl.Rows[i]["physicalStockDetailsId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtSlNo"].Value = dtbl.Rows[i]["slno"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtProductCode"].Value = dtbl.Rows[i]["productCode"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtProductName"].Value = dtbl.Rows[i]["productName"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtQty"].Value = dtbl.Rows[i]["qty"].ToString();
                    BatchComboFill(Convert.ToDecimal(dtbl.Rows[i]["productId"].ToString()), i, dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[i]["unitId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtbl.Rows[i]["godownId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(dtbl.Rows[i]["rackId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtRate"].Value = dtbl.Rows[i]["rate"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtAmount"].Value = dtbl.Rows[i]["amount"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtBarcode"].Value = dtbl.Rows[i]["barcode"].ToString();
                    if (dgvPhysicalStock.Columns.Count > 0)
                    {
                        dgvPhysicalStock.Columns["dgvtxtRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvPhysicalStock.Columns["dgvtxtAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                }
                isFromEditMode = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Delete function
 /// </summary>
 /// <param name="decPhysicalStockId"></param>
 public void DeleteFunction(decimal decPhysicalStockId)
 {
     try
     {
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         spPhysicalStockMaster.PhysicalStockDelete(decPhysicalStockId, decPhysicalStockVoucherTypeId, strVoucherNo);
         Messages.DeletedMessage();
         if (objfrmVoucherSearch != null)
         {
             this.Close();
             objfrmVoucherSearch.GridFill();
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 private void dgvPhysicalStock_CellLeave(object sender, DataGridViewCellEventArgs e)
 {
     if (!isFromEditMode)
     {
         try
         {
             string strBarcode = string.Empty;
             string strProductCode = string.Empty;
             ProductInfo infoProduct = new ProductInfo();
             ProductSP spProduct = new ProductSP();
             BatchSP spBatch = new BatchSP();
             PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
             if (e.RowIndex != -1 && e.ColumnIndex != -1)
             {
                 if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvcmbBatch")
                 {
                     if (dgvPhysicalStock.CurrentRow.Cells["dgvcmbBatch"].Value != null)
                     {
                         if (Convert.ToString(dgvPhysicalStock.CurrentRow.Cells["dgvcmbBatch"].Value) != string.Empty &&
                            Convert.ToDecimal(dgvPhysicalStock.CurrentRow.Cells["dgvcmbBatch"].Value) != 0)
                         {
                             if (isGridValueChanged)
                             {
                                 decBatchId = Convert.ToDecimal(dgvPhysicalStock.CurrentRow.Cells["dgvcmbBatch"].Value);
                                 strBarcode = spBatch.ProductBatchBarcodeViewByBatchId(decBatchId);
                                 isGridValueChanged = false;
                                 dgvPhysicalStock.CurrentRow.Cells["dgvtxtBarcode"].Value = strBarcode;
                                 isGridValueChanged = true;
                             }
                         }
                     }
                 }
                 CheckColumnMissing();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("PS:45" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
 /// <summary>
 /// Doing basic calculations in cell value change
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPhysicalStock_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         BatchSP spBatch = new BatchSP();
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         if (e.RowIndex != -1 && e.ColumnIndex != -1)
         {
             string strBarcode = string.Empty;
             string strProductCode = string.Empty;
             if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtBarcode")
             {
                 string strBCode = string.Empty;
                 DataTable dtbl = new DataTable();
                 if (dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value != null && dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString() != string.Empty)
                 {
                     strBCode = dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString();
                     productDetailsFill(strBCode, dgvPhysicalStock.CurrentRow.Index, "Barcode");
                     CheckColumnMissing();
                 }
             }
             else if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtProductCode")
             {
                 UnitInfo infoUnit = new UnitInfo();
                 string strPrdCode = string.Empty;
                 if (dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value != null && dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty)
                 {
                     strPrdCode = dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString();
                     productDetailsFill(strPrdCode, dgvPhysicalStock.CurrentRow.Index, "ProductCode");
                     CheckColumnMissing();
                 }
             }
             else if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtProductName")
             {
                 string strProductName = string.Empty;
                 DataTable dtbl = new DataTable();
                 if (dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value != null && dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value.ToString() != string.Empty)
                 {
                     strProductName = dgvPhysicalStock.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value.ToString();
                     productDetailsFill(strProductName, dgvPhysicalStock.CurrentRow.Index, "ProductName");
                     CheckColumnMissing();
                 }
             }
             if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtQty" && isAmountcalc || dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtRate" && isAmountcalc)
             {
                 NewAmountCalculation(e.RowIndex);
                 CheckColumnMissing();
             }
             if (dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtQty" && isAmountcalc || dgvPhysicalStock.Columns[e.ColumnIndex].Name == "dgvtxtRate" && isAmountcalc)
             {
                 CalculateTotalAmount();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:45" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #10
0
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo();
         PhysicalStockDetailsSP spPhysicalStockDetails = new PhysicalStockDetailsSP();
         PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text.Trim();
         infoPhysicalStockMaster.Date = Convert.ToDateTime(txtDate.Text);
         infoPhysicalStockMaster.Narration = txtNarration.Text.Trim();
         string s = txtTotalAmount.Text;
         infoPhysicalStockMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
         if (isAutomatic)
         {
             infoPhysicalStockMaster.SuffixPrefixId = decPhysicalStockSuffixPrefixId;
             infoPhysicalStockMaster.VoucherNo = strVoucherNo;
             infoPhysicalStockMaster.InvoiceNo = txtVoucherNo.Text;
         }
         else
         {
             infoPhysicalStockMaster.SuffixPrefixId = 0;
             infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text;
             infoPhysicalStockMaster.InvoiceNo = txtVoucherNo.Text;
         }
         infoPhysicalStockMaster.VoucherTypeId = decPhysicalStockVoucherTypeId;
         infoPhysicalStockMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         infoPhysicalStockMaster.Extra1 = string.Empty;
         infoPhysicalStockMaster.Extra2 = string.Empty;
         decPhysicalStockMasterIdentity = Convert.ToDecimal(spPhysicalStockMaster.PhysicalStockMasterAdd(infoPhysicalStockMaster));
         int inRowcount = dgvPhysicalStock.Rows.Count;
         for (int inI = 0; inI < inRowcount - 1; inI++)
         {
             if (dgvPhysicalStock.Rows[inI].HeaderCell.Value.ToString() != "X")
             {
                 infoPhysicalStockDetails.PhysicalStockMasterId = decPhysicalStockMasterIdentity;
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty)
                 {
                     infoProduct = spProduct.ProductViewByCode(dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                     infoPhysicalStockDetails.ProductId = infoProduct.ProductId;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.GodownId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value.ToString());
                 }
                 else
                 {
                     infoPhysicalStockDetails.GodownId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.RackId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value.ToString());
                 }
                 else
                 {
                     infoPhysicalStockDetails.RackId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.BatchId = Convert.ToDecimal(Convert.ToString(dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value));
                 }
                 else
                 {
                     infoPhysicalStockDetails.BatchId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.Qty = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.UnitId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                     infoPhysicalStockDetails.UnitConversionId = decConversionId;
                 }
                 infoPhysicalStockDetails.Rate = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                 infoPhysicalStockDetails.Amount = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                 infoPhysicalStockDetails.Slno = Convert.ToInt32(dgvPhysicalStock.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
                 infoPhysicalStockDetails.Extra1 = string.Empty;
                 infoPhysicalStockDetails.Extra2 = string.Empty;
                 spPhysicalStockDetails.PhysicalStockDetailsAdd(infoPhysicalStockDetails);
                 decimal decPId = infoPhysicalStockDetails.ProductId;
                 string strVoucher = infoPhysicalStockMaster.VoucherNo;
                 AddtoStockPosting(decPId, strVoucher);
             }
         }
         Messages.SavedMessage();
         if (dgvPhysicalStock.RowCount > 1)
         {
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decPhysicalStockMasterIdentity);
                 }
                 else
                 {
                     Print(decPhysicalStockMasterIdentity);
                 }
             }
         }
         clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }