/// <summary>
 /// Function to Update values in PhysicalStockMaster Table
 /// </summary>
 /// <param name="physicalstockmasterinfo"></param>
 public void PhysicalStockMasterEdit(PhysicalStockMasterInfo physicalstockmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.PhysicalStockMasterId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to Update values in PhysicalStockMaster Table
 /// </summary>
 /// <param name="physicalstockmasterinfo"></param>
 public void PhysicalStockMasterEdit(PhysicalStockMasterInfo physicalstockmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.PhysicalStockMasterId;
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
        /// <summary>
        /// Function to get particular values from PhysicalStockMaster table based on the parameter
        /// </summary>
        /// <param name="physicalStockMasterId"></param>
        /// <returns></returns>
        public PhysicalStockMasterInfo PhysicalStockMasterView(decimal physicalStockMasterId)
        {
            PhysicalStockMasterInfo physicalstockmasterinfo = new PhysicalStockMasterInfo();
            SqlDataReader           sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PhysicalStockMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
                sprmparam.Value = physicalStockMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    physicalstockmasterinfo.PhysicalStockMasterId = decimal.Parse(sdrreader[0].ToString());
                    physicalstockmasterinfo.VoucherNo             = sdrreader[1].ToString();
                    physicalstockmasterinfo.InvoiceNo             = sdrreader[2].ToString();
                    physicalstockmasterinfo.SuffixPrefixId        = decimal.Parse(sdrreader[3].ToString());
                    physicalstockmasterinfo.VoucherTypeId         = decimal.Parse(sdrreader[4].ToString());
                    physicalstockmasterinfo.Date            = DateTime.Parse(sdrreader[5].ToString());
                    physicalstockmasterinfo.Narration       = sdrreader[6].ToString();
                    physicalstockmasterinfo.TotalAmount     = decimal.Parse(sdrreader[7].ToString());
                    physicalstockmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
                    physicalstockmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[9].ToString());
                    physicalstockmasterinfo.Extra1          = sdrreader[10].ToString();
                    physicalstockmasterinfo.Extra2          = sdrreader[11].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(physicalstockmasterinfo);
        }
Esempio n. 4
0
        /// <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);
            }
        }
Esempio n. 5
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);
     }
 }
 /// <summary>
 /// Function to get particular values from PhysicalStockMaster table based on the parameter
 /// </summary>
 /// <param name="physicalStockMasterId"></param>
 /// <returns></returns>
 public PhysicalStockMasterInfo PhysicalStockMasterView(decimal physicalStockMasterId)
 {
     PhysicalStockMasterInfo physicalstockmasterinfo = new PhysicalStockMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalStockMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             physicalstockmasterinfo.PhysicalStockMasterId = decimal.Parse(sdrreader[0].ToString());
             physicalstockmasterinfo.VoucherNo = sdrreader[1].ToString();
             physicalstockmasterinfo.InvoiceNo = sdrreader[2].ToString();
             physicalstockmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             physicalstockmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[4].ToString());
             physicalstockmasterinfo.Date = DateTime.Parse(sdrreader[5].ToString());
             physicalstockmasterinfo.Narration = sdrreader[6].ToString();
             physicalstockmasterinfo.TotalAmount = decimal.Parse(sdrreader[7].ToString());
             physicalstockmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
             physicalstockmasterinfo.ExtraDate = DateTime.Parse(sdrreader[9].ToString());
             physicalstockmasterinfo.Extra1 = sdrreader[10].ToString();
             physicalstockmasterinfo.Extra2 = sdrreader[11].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return physicalstockmasterinfo;
 }