Example #1
0
        /// <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);
            }
        }
Example #2
0
 /// <summary>
 /// Adding PhysicalStockDetails when updating
 /// </summary>
 public void EditPhysicalStockDetails()
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         PhysicalStockDetailsInfo infoPhysicalStockDetails = new PhysicalStockDetailsInfo();
         PhysicalStockDetailsSP spPhysicalStockDetails = new PhysicalStockDetailsSP();
         int inRowcount = dgvPhysicalStock.Rows.Count;
         for (int inI = 0; inI < inRowcount - 1; inI++)
         {
             infoPhysicalStockDetails.PhysicalStockMasterId = decMasterId;
             infoPhysicalStockDetails.PhysicalStockDetailsId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtPhysicalStockDetailId"].Value);
             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[0].Cells["dgvcmbBatch"].Value == null && dgvPhysicalStock.Rows[0].Cells["dgvcmbBatch"].Value == null)
             {
                 MessageBox.Show("Can't update physical stock without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 dgvPhysicalStock.ClearSelection();
                 dgvPhysicalStock.Focus();
             }
             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.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);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #3
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);
     }
 }