コード例 #1
0
        /// <summary>
        /// Function to view type of voucher based on parameter
        /// </summary>
        /// <param name="decVoucherTypeId"></param>
        /// <returns></returns>
        public VoucherTypeInfo TypeOfVoucherBasedOnVoucherTypeId(decimal decVoucherTypeId)
        {
            SqlDataReader   sdrReader       = null;
            VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sqlcmd = new SqlCommand("TypeOfVoucherBasedOnVoucherTypeId", sqlcon);
                sqlcmd.CommandType = CommandType.StoredProcedure;
                sqlcmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal).Value = decVoucherTypeId;
                sdrReader = sqlcmd.ExecuteReader();
                while (sdrReader.Read())
                {
                    infoVoucherType.TypeOfVoucher = sdrReader["typeOfVoucher"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VTSP:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                sdrReader.Close();
                sqlcon.Close();
            }
            return(infoVoucherType);
        }
コード例 #2
0
 /// <summary>
 /// Function to fill the order no combobox  based on the deliverymode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbDeliveryMode_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmbDeliveryMode.SelectedIndex != 0)
         {
             cmbOrderNo.Enabled = true;
             DataTable dtbl = new DataTable();
             if (cmbDeliveryMode.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 decVoucherTypes = Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString());
             }
             if (cmbVoucherType.SelectedValue != null)
             {
                 infoVoucherType  = spVoucherType.TypeOfVoucherBasedOnVoucherTypeId(Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString()));
                 strTypeOfVoucher = infoVoucherType.TypeOfVoucher;
                 AgainstOrderComboFill();
             }
         }
         else
         {
             cmbOrderNo.DataSource = null;
             cmbOrderNo.Enabled    = false;
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "DNREP12:" + ex.Message;
     }
 }
コード例 #3
0
 /// <summary>
 /// Function to fill the order no combobox  based on the deliverymode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbDeliveryMode_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmbDeliveryMode.SelectedIndex != 0)
         {
             cmbOrderNo.Enabled = true;
             DataTable dtbl = new DataTable();
             if (cmbDeliveryMode.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 decVoucherTypes = Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString());
             }
             if (cmbVoucherType.SelectedValue != null)
             {
                 infoVoucherType  = BllVoucherType.TypeOfVoucherBasedOnVoucherTypeId(Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString()));
                 strTypeOfVoucher = infoVoucherType.TypeOfVoucher;
                 AgainstOrderComboFill();
             }
         }
         else
         {
             cmbOrderNo.DataSource = null;
             cmbOrderNo.Enabled    = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREP12: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #4
0
        /// <summary>
        /// Function to insert values to table and return id
        /// </summary>
        /// <param name="vouchertypeinfo"></param>
        /// <returns></returns>
        public decimal VoucherTypeAddWithIdentity(VoucherTypeInfo vouchertypeinfo)
        {
            decimal decVoucherTypeId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("VoucherTypeAddWithIdentity", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherTypeName", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.VoucherTypeName;
                sprmparam       = sccmd.Parameters.Add("@typeOfVoucher", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.TypeOfVoucher;
                sprmparam       = sccmd.Parameters.Add("@methodOfVoucherNumbering", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.MethodOfVoucherNumbering;
                sprmparam       = sccmd.Parameters.Add("@isTaxApplicable", SqlDbType.Bit);
                sprmparam.Value = vouchertypeinfo.IsTaxApplicable;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Extra2;
                sprmparam       = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
                sprmparam.Value = vouchertypeinfo.IsActive;
                sprmparam       = sccmd.Parameters.Add("@IsDefault", SqlDbType.Bit);
                sprmparam.Value = vouchertypeinfo.IsDefault;
                sprmparam       = sccmd.Parameters.Add("@masterId", SqlDbType.Int);
                sprmparam.Value = vouchertypeinfo.MasterId;
                sprmparam       = sccmd.Parameters.Add("@declaration", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Declarartion;
                sprmparam       = sccmd.Parameters.Add("@heading1", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Heading1;
                sprmparam       = sccmd.Parameters.Add("@heading2", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Heading2;
                sprmparam       = sccmd.Parameters.Add("@heading3", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Heading3;
                sprmparam       = sccmd.Parameters.Add("@heading4", SqlDbType.VarChar);
                sprmparam.Value = vouchertypeinfo.Heading4;
                object obj = sccmd.ExecuteScalar();
                if (obj != null)
                {
                    decVoucherTypeId = Convert.ToDecimal(obj.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decVoucherTypeId);
        }
コード例 #5
0
 /// <summary>
 /// Function to Update values in VoucherType Table
 /// </summary>
 /// <param name="vouchertypeinfo"></param>
 public void VoucherTypeEdit(VoucherTypeInfo vouchertypeinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypeinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeName", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.VoucherTypeName;
         sprmparam       = sccmd.Parameters.Add("@typeOfVoucher", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.TypeOfVoucher;
         sprmparam       = sccmd.Parameters.Add("@methodOfVoucherNumbering", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.MethodOfVoucherNumbering;
         sprmparam       = sccmd.Parameters.Add("@isTaxApplicable", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsTaxApplicable;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra2;
         sprmparam       = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsActive;
         sprmparam       = sccmd.Parameters.Add("@IsDefault", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsDefault;
         sprmparam       = sccmd.Parameters.Add("@masterId", SqlDbType.Int);
         sprmparam.Value = vouchertypeinfo.MasterId;
         sprmparam       = sccmd.Parameters.Add("@declaration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Declarartion;
         sprmparam       = sccmd.Parameters.Add("@heading1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading1;
         sprmparam       = sccmd.Parameters.Add("@heading2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading2;
         sprmparam       = sccmd.Parameters.Add("@heading3", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading3;
         sprmparam       = sccmd.Parameters.Add("@heading4", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading4;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #6
0
ファイル: VoucherTypeSP.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to Update values in VoucherType Table
 /// </summary>
 /// <param name="vouchertypeinfo"></param>
 public void VoucherTypeEdit(VoucherTypeInfo vouchertypeinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypeinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeName", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.VoucherTypeName;
         sprmparam = sccmd.Parameters.Add("@typeOfVoucher", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.TypeOfVoucher;
         sprmparam = sccmd.Parameters.Add("@methodOfVoucherNumbering", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.MethodOfVoucherNumbering;
         sprmparam = sccmd.Parameters.Add("@isTaxApplicable", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsTaxApplicable;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsActive;
         sprmparam = sccmd.Parameters.Add("@IsDefault", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsDefault;
         sprmparam = sccmd.Parameters.Add("@masterId", SqlDbType.Int);
         sprmparam.Value = vouchertypeinfo.MasterId;
         sprmparam = sccmd.Parameters.Add("@declaration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Declarartion;
         sprmparam = sccmd.Parameters.Add("@heading1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading1;
         sprmparam = sccmd.Parameters.Add("@heading2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading2;
         sprmparam = sccmd.Parameters.Add("@heading3", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading3;
         sprmparam = sccmd.Parameters.Add("@heading4", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading4;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #7
0
        /// <summary>
        /// Function to view all VoucherTypes based on parameter
        /// </summary>
        /// <param name="voucherTypeId"></param>
        /// <returns></returns>
        public VoucherTypeInfo VoucherTypeView(decimal voucherTypeId)
        {
            VoucherTypeInfo vouchertypeinfo = new VoucherTypeInfo();
            SqlDataReader   sdrreader       = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("VoucherTypeView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = voucherTypeId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    vouchertypeinfo.VoucherTypeId            = Convert.ToDecimal(sdrreader[0].ToString());
                    vouchertypeinfo.VoucherTypeName          = sdrreader[1].ToString();
                    vouchertypeinfo.TypeOfVoucher            = sdrreader[2].ToString();
                    vouchertypeinfo.MethodOfVoucherNumbering = sdrreader[3].ToString();
                    vouchertypeinfo.IsTaxApplicable          = Convert.ToBoolean(sdrreader[4].ToString());
                    vouchertypeinfo.Narration    = sdrreader[5].ToString();
                    vouchertypeinfo.ExtraDate    = Convert.ToDateTime(sdrreader[6].ToString());
                    vouchertypeinfo.Extra1       = sdrreader[7].ToString();
                    vouchertypeinfo.Extra2       = sdrreader[8].ToString();
                    vouchertypeinfo.IsActive     = Convert.ToBoolean(sdrreader[9].ToString());
                    vouchertypeinfo.MasterId     = Convert.ToInt32(sdrreader[10].ToString());
                    vouchertypeinfo.Declarartion = sdrreader[11].ToString();
                    vouchertypeinfo.Heading1     = sdrreader[12].ToString();
                    vouchertypeinfo.Heading2     = sdrreader[13].ToString();
                    vouchertypeinfo.Heading3     = sdrreader[14].ToString();
                    vouchertypeinfo.Heading4     = sdrreader[15].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(vouchertypeinfo);
        }
コード例 #8
0
        /// <summary>
        /// Function to check method fo voucher numbering based on parameter
        /// </summary>
        /// <param name="voucherTypeId"></param>
        /// <returns></returns>
        public bool CheckMethodOfVoucherNumbering(decimal voucherTypeId)
        {
            VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
            SqlDataReader   sdrreader       = null;
            bool            isAutomatic     = false;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CheckMethodOfVoucherNumbering", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = voucherTypeId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    infoVoucherType.MethodOfVoucherNumbering = sdrreader["methodOfVoucherNumbering"].ToString();
                }
                if (infoVoucherType.MethodOfVoucherNumbering == "Automatic")
                {
                    isAutomatic = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(isAutomatic);
        }
コード例 #9
0
ファイル: frmSalesOrder.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to use to fill details to updation when comes register or report
 /// </summary>
 public void FillRegisterOrReport()
 {
     try
     {
         SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
         SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo();
         SalesOrderDetailsSP spSalesOrderDetails = new SalesOrderDetailsSP();
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         isValueChange = false;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtOrderNo.ReadOnly = true;
         infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(decSalesOrderMasterId);
         txtOrderNo.Text = infoSalesOrderMaster.InvoiceNo;
         strVoucherNo = infoSalesOrderMaster.VoucherNo.ToString();
         decSalesSuffixPrefixId = Convert.ToDecimal(infoSalesOrderMaster.SuffixPrefixId);
         decSalesVoucherId = Convert.ToDecimal(infoSalesOrderMaster.VoucherTypeId);
         isAutomatic = new VoucherTypeSP().CheckMethodOfVoucherNumbering(decSalesVoucherId);
         decSalesOrderTypeId = decSalesVoucherId;
         txtDate.Text = infoSalesOrderMaster.Date.ToString("dd-MMM-yyyy");
         cmbCashOrParty.SelectedValue = infoSalesOrderMaster.LedgerId;
         decSalesOrderVoucherTypeId = infoSalesOrderMaster.VoucherTypeId;
         VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         infoVoucherType = spVoucherType.VoucherTypeView(decSalesOrderVoucherTypeId);
         string strVoucherTypeName = infoVoucherType.VoucherTypeName;
         this.Text = strVoucherTypeName;
         if (infoSalesOrderMaster.QuotationMasterId == 0)
         {
             cmbType.SelectedItem = "NA";
         }
         else if (infoSalesOrderMaster.QuotationMasterId != 0)
         {
             infoSalesQuotationMaster = new SalesQuotationMasterSP().SalesQuotationMasterView(infoSalesOrderMaster.QuotationMasterId);
             cmbType.SelectedValue = infoSalesQuotationMaster.VoucherTypeId;
             AgainstQuotationComboFill();
             cmbQuotationNo.SelectedValue = infoSalesOrderMaster.QuotationMasterId;
         }
         txtDueDate.Text = infoSalesOrderMaster.DueDate.ToString("dd-MMM-yyyy");
         TimeSpan objTs = Convert.ToDateTime(txtDueDate.Text).Subtract(Convert.ToDateTime(txtDate.Text));
         txtDueDays.Text = objTs.Days.ToString();
         txtNarration.Text = infoSalesOrderMaster.Narration;
         cmbCurrency.SelectedValue = infoSalesOrderMaster.ExchangeRateId;
         cmbPricingLevel.SelectedValue = infoSalesOrderMaster.PricinglevelId;
         SalesManComboFill();
         cmbSalesMan.SelectedValue = infoSalesOrderMaster.EmployeeId;
         txtTotalAmount.Text = infoSalesOrderMaster.TotalAmount.ToString();
         DataTable dtbl = new DataTable();
         dtbl = spSalesOrderDetails.SalesOrderDetailsViewByMasterId(decSalesOrderMasterId);
         if (CheckCancelStatus(decSalesOrderMasterId))
         {
             isCheck = true;
             cbxCancelled.Checked = true;
             cbxCancelled.Enabled = false;
             btnSave.Enabled = false;
             isCheck = false;
         }
         else
         {
             isCheck = true;
             cbxCancelled.Enabled = true;
             cbxCancelled.Checked = false;
             isCheck = false;
         }
         if (isAutomatic)
         {
             txtOrderNo.ReadOnly = true;
             txtDate.Focus();
         }
         else
         {
             txtOrderNo.ReadOnly = false;
             txtOrderNo.Focus();
         }
         for (int i = 0; i < dtbl.Rows.Count; i++)
         {
             isAmountcalc = false;
             isValueChange = false;
             dgvSalesOrder.Rows.Add();
             dgvSalesOrder.Rows[i].HeaderCell.Value = string.Empty;
             dgvSalesOrder.Rows[i].Cells["dgvtxtSalesOrderDetailsId"].Value = Convert.ToDecimal(dtbl.Rows[i]["salesOrderDetailsId"].ToString());
             dgvSalesOrder.Rows[i].Cells["dgvtxtProductId"].Value = dtbl.Rows[i]["productId"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtProductCode"].Value = dtbl.Rows[i]["productCode"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtProductName"].Value = dtbl.Rows[i]["productName"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtQty"].Value = dtbl.Rows[i]["qty"].ToString();
             UnitComboFill(Convert.ToDecimal(dgvSalesOrder.Rows[i].Cells["dgvtxtProductId"].Value.ToString()), i, dgvSalesOrder.Rows[i].Cells["dgvcmbUnit"].ColumnIndex);
             dgvSalesOrder.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[i]["unitId"].ToString());
             dgvSalesOrder.Rows[i].Cells["dgvtxtRate"].Value = dtbl.Rows[i]["rate"].ToString();
             BatchComboFill(Convert.ToDecimal(dgvSalesOrder.Rows[i].Cells["dgvtxtProductId"].Value.ToString()), i, dgvSalesOrder.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
             dgvSalesOrder.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString());
             dgvSalesOrder.Rows[i].Cells["dgvtxtBarcode"].Value = dtbl.Rows[i]["barcode"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtAmount"].Value = dtbl.Rows[i]["amount"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[i]["unitConversionId"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtConversionRate"].Value = dtbl.Rows[i]["conversionRate"].ToString();
             dgvSalesOrder.Rows[i].Cells["dgvtxtSalesQuotationDetailsId"].Value = dtbl.Rows[i]["quotationDetailsId"].ToString();
             if (Convert.ToDecimal(dtbl.Rows[i]["quotationDetailsId"].ToString()) != 0)
             {
                 dgvSalesOrder.Rows[i].Cells["dgvtxtProductCode"].ReadOnly = true;
                 dgvSalesOrder.Rows[i].Cells["dgvtxtProductName"].ReadOnly = true;
                 dgvSalesOrder.Rows[i].Cells["dgvtxtBarcode"].ReadOnly = true;
             }
             if (cmbQuotationNo.Visible == true)
             {
                 dgvSalesOrder.Rows[i].Cells["dgvcmbUnit"].ReadOnly = true;
             }
         }
         isAmountcalc = true;
         isEditFill = false;
         isValueChange = true;
         isDoAfterGridFill = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #10
0
        /// <summary>
        /// Function to fill the fields for edit or delete
        /// </summary>
        public void FillFunction()
        {
            try
            {
                JournalMasterInfo infoJournalMaster = new JournalMasterInfo();
                JournalMasterSP spJournalMaster = new JournalMasterSP();
                infoJournalMaster = spJournalMaster.JournalMasterView(decJournalMasterIdForEdit);

                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                infoVoucherType = spVoucherType.VoucherTypeView(infoJournalMaster.VoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;

                txtVoucherNo.ReadOnly = false;
                strVoucherNo = infoJournalMaster.VoucherNo;
                strInvoiceNo = infoJournalMaster.InvoiceNo;
                txtVoucherNo.Text = strInvoiceNo;
                decJournalSuffixPrefixId = infoJournalMaster.SuffixPrefixId;
                decJournalVoucherTypeId = infoJournalMaster.VoucherTypeId;
                dtpVoucherDate.Value = infoJournalMaster.Date;
                txtNarration.Text = infoJournalMaster.Narration;

                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId);
                if (isAutomatic)
                {
                    txtVoucherNo.ReadOnly = true;
                }
                else
                {
                    txtVoucherNo.ReadOnly = false;
                }

                //GridFill
                DataTable dtbl = new DataTable();
                JournalDetailsSP spJournalDetailsSp = new JournalDetailsSP();
                dtbl = spJournalDetailsSp.JournalDetailsViewByMasterId(decJournalMasterIdForEdit);

                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
                for (int inI = 0; inI < dtbl.Rows.Count; inI++)
                {
                    dgvJournalVoucher.Rows.Add();
                    dgvJournalVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());

                    if (Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()) == 0)
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Cr";
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["credit"].ToString());
                    }
                    else
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Dr";
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString());
                    }
                    dgvJournalVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
                    if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty)
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString();
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = (Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString())).ToString("dd-MMM-yyyy");
                    }
                    dgvJournalVoucher.Rows[inI].Cells["dgvtxtDetailsId"].Value = dtbl.Rows[inI]["journalDetailsId"].ToString();

                    decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["journalDetailsId"].ToString());
                    decimal decLedgerPostingId = spLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decJournalVoucherTypeId);
                    dgvJournalVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
                    btnSave.Text = "Update";

                }

                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                DataTable dtbl1 = new DataTable();
                dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decJournalVoucherTypeId, strVoucherNo, infoJournalMaster.Date);


                dtblPartyBalance = dtbl1;
                dgvJournalVoucher.ClearSelection();
                txtDate.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show("JV37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #11
0
 /// <summary>
 /// Fill function from coming from register or report or other forms
 /// </summary>
 public void FillRegisterOrReport()
 {
     SalesMasterSP spSalesMaster = new SalesMasterSP();
     SalesDetailsSP spSalesDetails = new SalesDetailsSP();
     VoucherTypeSP spVoucherType = new VoucherTypeSP();
     SalesBillTaxSP spSalesBillTax = new SalesBillTaxSP();
     try
     {
         isFromEditMode = true;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtInvoiceNo.ReadOnly = true;
         DataTable dtblMaster = spSalesMaster.SalesInvoiceSalesMasterViewBySalesMasterId(decSalesInvoiceIdToEdit);
         DecSalesInvoiceVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString());
         VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
         infoVoucherType = spVoucherType.VoucherTypeView(DecSalesInvoiceVoucherTypeId);
         this.Text = infoVoucherType.VoucherTypeName;
         txtDate.Text = dtblMaster.Rows[0]["date"].ToString();
         dtpDate.Value = DateTime.Parse(txtDate.Text);
         CurrencyComboFill();
         txtInvoiceNo.Text = dtblMaster.Rows[0]["invoiceNo"].ToString();
         txtCreditPeriod.Text = dtblMaster.Rows[0]["creditPeriod"].ToString();
         strVoucherNo = dtblMaster.Rows[0]["voucherNo"].ToString();
         decSalseInvoiceSuffixPrefixId = Convert.ToDecimal(dtblMaster.Rows[0]["suffixPrefixId"].ToString());
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(DecSalesInvoiceVoucherTypeId);
         cmbCashOrParty.SelectedValue = dtblMaster.Rows[0]["ledgerId"].ToString();
         cmbSalesAccount.SelectedValue = dtblMaster.Rows[0]["salesAccount"].ToString();
         cmbSalesMan.SelectedValue = dtblMaster.Rows[0]["employeeId"].ToString();
         txtCustomer.Text = dtblMaster.Rows[0]["customerName"].ToString();
         txtTransportCompany.Text = dtblMaster.Rows[0]["transportationCompany"].ToString();
         txtVehicleNo.Text = dtblMaster.Rows[0]["lrNo"].ToString();
         txtNarration.Text = dtblMaster.Rows[0]["narration"].ToString();
         cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());
         txtTotalAmount.Text = dtblMaster.Rows[0]["totalAmount"].ToString();
         lblTaxTotalAmount.Text = dtblMaster.Rows[0]["taxAmount"].ToString();
         cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString());
         if (dtblMaster.Rows[0]["quotationMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against Quotation";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["quotationMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Quotation No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else if (dtblMaster.Rows[0]["orderMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against SalesOrder";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["orderMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Order No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else if (dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against Delivery Note";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Delivery Note No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else
         {
             cmbSalesMode.SelectedText = "NA";
         }
         if (txtInvoiceNo.Enabled)
         {
             txtDate.Focus();
         }
         else
         {
             txtInvoiceNo.Focus();
         }
         DataTable dtblDetails = new DataTable();
         dtblDetails = spSalesDetails.SalesInvoiceSalesDetailsViewBySalesMasterId(decSalesInvoiceIdToEdit);
         dgvSalesInvoiceTaxComboFill();
         dgvSalesInvoice.Rows.Clear();
         for (int i = 0; i < dtblDetails.Rows.Count; i++)
         {
             dgvSalesInvoice.Rows.Add();
             IsSetGridValueChange = false;
             dgvSalesInvoice.Rows[i].HeaderCell.Value = string.Empty;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["salesDetailsId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSlno"].Value = dtblDetails.Rows[i]["slNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].Value = dtblDetails.Rows[i]["barcode"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = dtblDetails.Rows[i]["productCode"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].Value = dtblDetails.Rows[i]["productName"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductId"].Value = dtblDetails.Rows[i]["productId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].Value = dtblDetails.Rows[i]["brandName"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQty"].Value = dtblDetails.Rows[i]["qty"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = dtblDetails.Rows[i]["purchaseRate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceAmount"].Value = dtblDetails.Rows[i]["amount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceGrossValue"].Value = dtblDetails.Rows[i]["grossAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["unitId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value = dtblDetails.Rows[i]["rate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["godownId"].ToString());
             RackComboFill(Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value.ToString()), i, dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].ColumnIndex);
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["rackId"].ToString());
             if (dtblDetails.Rows[i]["batchId"] != null && dtblDetails.Rows[i]["batchId"].ToString() != string.Empty)
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["batchId"].ToString());
             }
             else
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = string.Empty;
             }
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceMrp"].Value = dtblDetails.Rows[i]["mrp"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesRate"].Value = dtblDetails.Rows[i]["salesRate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].Value = dtblDetails.Rows[i]["discount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceNetAmount"].Value = dtblDetails.Rows[i]["netAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceTaxName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["taxId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = dtblDetails.Rows[i]["taxAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = dtblDetails.Rows[i]["unitConversionId"].ToString();
             lblTotalQuantitydisplay.Text = dtblDetails.Rows[i]["qty"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSISalesOrderDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["orderDetailsId"].ToString());  // here get fill the grid colum for the editing prps
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = dtblDetails.Rows[i]["deliveryNoteDetailsId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQuotationDetailsId"].Value = dtblDetails.Rows[i]["quotationDetailsId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["voucherTypeRefNo"].ToString());  // here get fill the grid colum for the editing prps
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = dtblDetails.Rows[i]["voucherRefNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = dtblDetails.Rows[i]["invoiceRefNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].ReadOnly = true;
             if (cmbSalesMode.SelectedIndex != 0)
             {
                 strVoucherNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString();
                 strInvoiceNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString();
                 decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value);
             }
             GrossValueCalculation(i);
             DiscountCalculation(i, dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].ColumnIndex);
             taxAndGridTotalAmountCalculation(i);
             decCurrentRate = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value.ToString());
             decCurrentConversionRate = Convert.ToDecimal(dtblDetails.Rows[i]["conversionRate"].ToString());
             UnitConversionCalc(i);
             if (cmbSalesModeOrderNo.Visible == true)
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true;
             }
         }
         DataTable dtblAdditionalCost = new DataTable();
         dtblAdditionalCost = spSalesMaster.SalesInvoiceAdditionalCostViewByVoucherNoUnderVoucherType(DecSalesInvoiceVoucherTypeId, strVoucherNo);
         for (int i = 0; i < dtblAdditionalCost.Rows.Count; i++)
         {
             dgvSalesInvoiceLedger.Rows.Add();
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCostId"].Value = dtblAdditionalCost.Rows[i]["additionalCostId"].ToString();
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvCmbAdditionalCostledgerName"].Value = Convert.ToDecimal(dtblAdditionalCost.Rows[i]["ledgerId"].ToString());
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCoastledgerAmount"].Value = dtblAdditionalCost.Rows[i]["amount"].ToString();
             DataTable dtblAdcostForView = new DataTable();
             AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
             dtblAdcostForView = SpAccountLedger.AccountLedgerViewForAdditionalCost();
             DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvSalesInvoiceLedger[dgvSalesInvoiceLedger.Columns["dgvCmbAdditionalCostledgerName"].Index, i];
             dgvccVoucherType.DataSource = dtblAdcostForView;
             dgvccVoucherType.ValueMember = "ledgerId";
             dgvccVoucherType.DisplayMember = "ledgerName";
         }
         DataTable dtblDrOrCr = spSalesMaster.salesinvoiceAdditionalCostCheckdrOrCrforSiEdit(DecSalesInvoiceVoucherTypeId, strVoucherNo);
         if (dtblDrOrCr.Rows.Count > 0)
         {
             if (Convert.ToDecimal(dtblDrOrCr.Rows[0]["credit"].ToString()) != 0)
             {
                 cmbCashOrbank.SelectedValue = Convert.ToDecimal(dtblDrOrCr.Rows[0]["ledgerId"].ToString());
                 cmbCashOrbank.Visible = true;
                 lblcashOrBank.Visible = true;
                 cmbDrorCr.SelectedIndex = 0;
                 decBankOrCashIdForEdit = Convert.ToDecimal(cmbCashOrbank.SelectedValue.ToString());
             }
             else
             {
                 cmbDrorCr.SelectedIndex = 1;
             }
         }
         taxGridFill();
         DataTable dtblTax = new DataTable();
         dtblTax = spSalesBillTax.SalesInvoiceSalesBillTaxViewAllBySalesMasterId(decSalesInvoiceIdToEdit);
         foreach (DataGridViewRow dgvrowTax in dgvSalesInvoiceTax.Rows)
         {
             for (int ini = 0; ini < dtblTax.Rows.Count; ini++)
             {
                 if (dgvrowTax.Cells["dgvtxtTtaxId"].Value != null && dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() != string.Empty)
                 {
                     decimal decId = Convert.ToDecimal(dtblTax.Rows[ini]["taxId"].ToString());
                     if (dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() == decId.ToString())
                     {
                         dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = dtblTax.Rows[ini]["taxAmount"].ToString();
                         break;
                     }
                     else
                     {
                         dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = "0.00";
                     }
                 }
             }
         }
         LedgerGridTotalAmountCalculation();
         SiGridTotalAmountCalculation();
         txtGrandTotal.Text = dtblMaster.Rows[0]["grandTotal"].ToString();
         txtBillDiscount.Text = dtblMaster.Rows[0]["billDiscount"].ToString();
         bool isPartyBalanceRef = false;
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         isPartyBalanceRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId);
         if (isPartyBalanceRef)
         {
             cmbCashOrParty.Enabled = false;
         }
         else
         {
             cmbCashOrParty.Enabled = true;
         }
         //if (!spPartyBalance.PartyBalanceCheckReference(DecSalesInvoiceVoucherTypeId, strVoucherNo))
         //{
         //    cmbCashOrParty.Enabled = false;
         //}
         //else
         //{
         //    cmbCashOrParty.Enabled = true;
         //}
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 77" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #12
0
        /// <summary>
        /// To fill the details according to the DeliveryNote master Id from frmDeliveryNoteRegister and frmDeliveryNoteReport
        /// </summary>
        public void FillRegisterOrReport()
        {
            try
            {
                DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
                SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo();
                SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
                SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
                SalesQuotationMasterSP spSalesQuotationMaster = new SalesQuotationMasterSP();
                dgvProduct.Rows.Clear();
                isRegisterReportFill = true;
                btnSave.Text = "Update";
                int inRowIndex = 0;
                btnDelete.Enabled = true;
                txtDeliveryNoteNo.ReadOnly = true;
                if (txtDeliveryNoteNo.ReadOnly == true)
                {
                    txtDate.Focus();
                }
                else
                {
                    txtDeliveryNoteNo.Focus();
                }

                infoDeliveryNoteMaster = spDeliveryNoteMaster.DeliveryNoteMasterViewAllByMasterId(decDelivryNoteIdToEdit);
                txtDeliveryNoteNo.Text = infoDeliveryNoteMaster.InvoiceNo;
                strVoucherNo = infoDeliveryNoteMaster.VoucherNo.ToString();
                decDeliveryNoteSuffixPrefixId = Convert.ToDecimal(infoDeliveryNoteMaster.SuffixPrefixId);
                decDeliveryNoteVoucherTypeId = Convert.ToDecimal(infoDeliveryNoteMaster.VoucherTypeId);
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId);
                decDeliveryNoteTypeId = decDeliveryNoteVoucherTypeId;
                cmbCashOrParty.SelectedValue = infoDeliveryNoteMaster.LedgerId;
                txtDate.Text = infoDeliveryNoteMaster.Date.ToString("dd-MMM-yyyy");
                cmbPricingLevel.SelectedValue = infoDeliveryNoteMaster.PricinglevelId;
                infoVoucherType = spVoucherType.VoucherTypeView(decDeliveryNoteVoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;
                if (infoDeliveryNoteMaster.OrderMasterId != 0)
                {
                    cmbDeliveryMode.Text = "Against Order";
                    infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId);
                    cmbType.SelectedValue = infoSalesOrderMaster.VoucherTypeId;
                    AgainstOrderComboFill();
                    cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.OrderMasterId;
                }
                else if (infoDeliveryNoteMaster.QuotationMasterId != 0)
                {
                    cmbDeliveryMode.Text = "Against Quotation";
                    infoSalesQuotationMaster = spSalesQuotationMaster.SalesQuotationMasterView(infoDeliveryNoteMaster.QuotationMasterId);
                    cmbType.SelectedValue = infoSalesQuotationMaster.VoucherTypeId;
                    AgainstQuotationComboFill();
                    cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.QuotationMasterId;
                }
                CurrencyComboFill();
                cmbSalesMan.SelectedValue = infoDeliveryNoteMaster.EmployeeId;
                cmbCurrency.SelectedValue = infoDeliveryNoteMaster.ExchangeRateId;
                txtTraspotationCompany.Text = infoDeliveryNoteMaster.TransportationCompany;
                txtNarration.Text = infoDeliveryNoteMaster.Narration;
                txtLRNo.Text = infoDeliveryNoteMaster.LrNo;
                txtTotalAmnt.Text = infoDeliveryNoteMaster.TotalAmount.ToString("00.00");
                DataTable dtblDetails = spDeliveryNoteDetails.DeliveryNoteDetailsViewByDeliveryNoteMasterId(decDelivryNoteIdToEdit);
                foreach (DataRow drowDetails in dtblDetails.Rows)
                {
                    dgvProduct.Rows.Add();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true;
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = drowDetails["barcode"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherNo"].Value = drowDetails["VoucherNo"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtInvoiceNo"].Value = drowDetails["OrderNoOrQuotationNo"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherTypeId"].Value = drowDetails["VoucherTypeId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductId"].Value = drowDetails["productId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = drowDetails["productCode"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = drowDetails["productName"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["Col"].Value = drowDetails["slNo"].ToString();
                    if (Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString()) == 0)
                    {
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = 0;
                    }
                    else
                    {
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString());
                    }
                    if (Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString()) != 0)
                    {
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString());
                    }
                    BatchComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex);
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString());
                    UnitComboFill1(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex);
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                    GridGodownComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ColumnIndex);
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(drowDetails["godownId"].ToString());
                    RackComboFill1(Convert.ToDecimal(drowDetails["godownId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ColumnIndex);
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].Value = Convert.ToDecimal(drowDetails["rackId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = drowDetails["qty"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = drowDetails["rate"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = drowDetails["unitConversionId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = drowDetails["conversionRate"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = drowDetails["amount"].ToString();
                    if (cmbOrderNo.Visible == true)
                    {
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
                    }
                    if (spDeliveryNoteMaster.DeliveryNoteMasterReferenceCheckRejectionIn(decDelivryNoteIdToEdit))
                    {
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].ReadOnly = true;
                        dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
                    }
                    dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = "";
                    AmountCalculation("dgvtxtQty", inRowIndex);
                    TotalAmountCalculation();
                }
                if (!isAutomatic)
                {
                    txtDeliveryNoteNo.ReadOnly = false;
                    txtDeliveryNoteNo.Focus();
                }
                isRegisterReportFill = false;
                isDoAfterGridFill = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN19: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #13
0
 /// <summary>
 /// Function for fill details in Purchase Return when coming from Register or Report
 /// </summary>
 public void FillRegisterOrReport()
 {
     try
     {
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtReturnNo.ReadOnly = true;
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         DataTable dtblPurchaseReturnMaster = new DataTable();
         DataTable dtblPurchaseMasterViewById = new DataTable();
         UnitConvertionSP SPUnitConversion = new UnitConvertionSP();
         PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
         PurchaseReturnDetailsSP SPPurchaseReturnDetails = new PurchaseReturnDetailsSP();
         BatchSP spBatch = new BatchSP();
         DataTable dtbl = new DataTable();
         decimal decPurchaseReturnDetailsId = 0;
         decimal decTotalValue = 0;
         decimal decRegisterTotalAmount = 0;
         decimal decInvoiceNo = 0;
         dtblPurchaseReturnMaster = SPPurchaseReturnMaster.PurchaseReturnViewByPurchaseReturnMasterId(decPurchaseReturnMasterId);
         if (dtblPurchaseReturnMaster.Rows.Count > 0)
         {
             txtReturnNo.Text = dtblPurchaseReturnMaster.Rows[0]["invoiceNo"].ToString();
             strReturnNo = dtblPurchaseReturnMaster.Rows[0]["invoiceNo"].ToString();
             strVoucherNo = dtblPurchaseReturnMaster.Rows[0]["voucherNo"].ToString();
             decPurchaseReturnSuffixPrefixId = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["suffixPrefixId"].ToString());
             decPurchaseReturnVoucherTypeId = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["voucherTypeId"].ToString());
             VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
             infoVoucherType = spVoucherType.VoucherTypeView(decPurchaseReturnVoucherTypeId);
             this.Text = infoVoucherType.VoucherTypeName;
             isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPurchaseReturnVoucherTypeId);
             txtReturnNo.ReadOnly = (isAutomatic) ? true : false;
             decPurchaseReturnTypeId = decPurchaseReturnVoucherTypeId;
             dtpDate.Text = dtblPurchaseReturnMaster.Rows[0]["date"].ToString();
             cmbCashOrParty.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["ledgerId"].ToString();
             cmbPurchaseAccount.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["purchaseAccount"].ToString();
             txtTransportationCompany.Text = dtblPurchaseReturnMaster.Rows[0]["transportationCompany"].ToString();
             txtNarration.Text = dtblPurchaseReturnMaster.Rows[0]["narration"].ToString();
             txtLrlNo.Text = dtblPurchaseReturnMaster.Rows[0]["lrNo"].ToString();
             cmbCurrency.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["exchangeRateId"].ToString();
             if (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty)
             {
                 cmbVoucherType.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString();
             }
             else
             {
                 cmbVoucherType.SelectedValue = 0;
             }
             cmbInvoiceNo.Text = dtblPurchaseReturnMaster.Rows[0]["invoiceNo1"].ToString();
             if (dtblPurchaseReturnMaster.Rows[0]["totalAmount1"].ToString() != string.Empty)
             {
                 decRegisterTotalAmount = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["totalAmount"].ToString());
             }
             txtTotalAmount.Text = dtblPurchaseReturnMaster.Rows[0]["totalAmount"].ToString();
             if (dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"].ToString() != string.Empty && Convert.ToInt32(dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"]) != 0)
             {
                 InvoiceNoComboFillInRegister();
                 cmbInvoiceNo.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"];
                 decInvoiceNo = Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString());
                 dtblPurchaseMasterViewById = SPPurchaseReturnMaster.PurchaseReturnMasterViewByPurchaseMasterId(Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"].ToString()));
             }
             else
             {
                 cmbInvoiceNo.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"];
             }
             strInvoiceNo = dtblPurchaseReturnMaster.Rows[0]["invoiceNo1"].ToString();
             decimal decDiscnt = Math.Round(Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["discount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
             dtbl = SPPurchaseReturnDetails.PurchaseReturnDetailsViewByMasterId(decPurchaseReturnMasterId);
             dgvPurchaseReturn.Rows.Clear();
             for (int i = 0; i < dtbl.Rows.Count; i++)
             {
                 isAmountcalc = false;
                 dgvPurchaseReturn.Rows.Add();
                 int ini = dgvPurchaseReturn.Rows.Count;
                 decPurchaseReturnDetailsId = Convert.ToDecimal(dtbl.Rows[i]["purchaseReturnDetailsId"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtSlNo"].Value = dtbl.Rows[i]["slno"].ToString();
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductCode"].Value = dtbl.Rows[i]["productCode"].ToString();
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductName"].Value = dtbl.Rows[i]["productName"].ToString();
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductId"].Value = dtbl.Rows[i]["productId"].ToString();
                 decimal decProductId = Convert.ToDecimal(dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductId"].Value.ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtConversionRate"].Value = SPUnitConversion.UnitConversionRateByUnitConversionId(decimal.Parse(dtbl.Rows[i]["unitConversionId"].ToString()));
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtUnitConversionId"].Value = decimal.Parse(dtbl.Rows[i]["unitConversionId"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtqty"].Value = (dtbl.Rows[i]["qty"].ToString() != string.Empty) ? Convert.ToDecimal(dtbl.Rows[i]["qty"].ToString()) : 0;
                 if (dtbl.Rows[i]["unitName"].ToString() != string.Empty)
                 {
                     UnitComboFill(decProductId, dgvPurchaseReturn.Rows[i].Index, dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].ColumnIndex);
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].Value = dtbl.Rows[i]["unitName"].ToString();
                 }
                 else
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].Value = "NA";
                 }
                 dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].ReadOnly = (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty) ? true : false;
                 if (dtbl.Rows[i]["godownId"].ToString() != string.Empty)
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtbl.Rows[i]["godownId"].ToString());
                 }
                 else
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbGodown"].Value = "NA";
                 }
                 if (dtbl.Rows[i]["rackId"].ToString() != string.Empty)
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[i]["rackId"].ToString());
                 }
                 else
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvCmbRack"].Value = "NA";
                 }
                 if (dtbl.Rows[i]["batchId"].ToString() != string.Empty)
                 {
                     BatchComboFill(decProductId, dgvPurchaseReturn.Rows[i].Index, dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString());
                 }
                 else
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].Value = "NA";
                 }
                 if (dtbl.Rows[i]["taxId"].ToString() != string.Empty && dtbl.Rows[i]["taxId"].ToString() != "NA")
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbTax"].Value = Convert.ToDecimal(dtbl.Rows[i]["taxId"].ToString());
                 }
                 else
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbTax"].Value = "NA";
                 }
                 if (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty)
                 {
                     dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].ReadOnly = true;
                 }
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtPurchaseDetailsId"].Value = dtbl.Rows[i]["purchaseDetailsId"].ToString();
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtbarcode"].Value = dtbl.Rows[i]["barcode"].ToString();
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtPurchaseReturnDetailsId"].Value = decPurchaseReturnDetailsId;
                 decimal decRate = Convert.ToDecimal(dtbl.Rows[i]["rate"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtrate"].Value = Math.Round(decRate, PublicVariables._inNoOfDecimalPlaces);
                 decimal decGross = Convert.ToDecimal(dtbl.Rows[i]["grossAmount"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtgrossValue"].Value = Math.Round(decGross, PublicVariables._inNoOfDecimalPlaces);
                 decimal decDis = Convert.ToDecimal(dtbl.Rows[i]["discount"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtdiscount"].Value = Math.Round(decDis, PublicVariables._inNoOfDecimalPlaces);
                 decimal decNet = Convert.ToDecimal(dtbl.Rows[i]["netAmount"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtNetAmount"].Value = Math.Round(decNet, PublicVariables._inNoOfDecimalPlaces);
                 decimal decTax = Convert.ToDecimal(dtbl.Rows[i]["taxAmount"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxttaxAmount"].Value = Math.Round(decTax, PublicVariables._inNoOfDecimalPlaces);
                 decimal decTotal = Convert.ToDecimal(dtbl.Rows[i]["amount"].ToString());
                 dgvPurchaseReturn.Rows[i].Cells["dgvtxtAmount"].Value = Math.Round(decTotal, PublicVariables._inNoOfDecimalPlaces);
                 decTotalValue = decTotalValue + Convert.ToDecimal(dtbl.Rows[i]["amount"].ToString());
                 if (cmbInvoiceNo.Visible == true)
                 {
                     dgvPurchaseReturn.Rows[dgvPurchaseReturn.Rows.Count - 1].ReadOnly = true;
                 }
             }
             lblTaxAmount.Text = Math.Round(decimal.Parse(dtblPurchaseReturnMaster.Rows[0]["totalTax"].ToString()), 2).ToString(); ;
             txtTotalAmount.Text = decTotalValue.ToString();
             txtBillDiscount.Text = decDiscnt.ToString();
             DGVPurchaseReturnTaxFill();
             DGVTaxCombofill();
             Calculate();
             isAmountcalc = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:55" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #14
0
ファイル: frmVoucherType.cs プロジェクト: jsoques/openmiracle
        /// <summary>
        /// when cell double click for update function
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvVoucherType_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    isEditMode = true;
                    btnSave.Text = "Update";
                    txtVoucherNameSearch.Focus();
                    btnDelete.Enabled = true;
                    int inRowCount = dgvApplicableTaxes.RowCount;
                    for (int i = 0; i < inRowCount; i++)
                    {
                        dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = false;
                    }

                    VoucherTypeSP spVoucherType = new VoucherTypeSP();
                    VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                    decVoucherTypeId = Convert.ToDecimal(dgvVoucherType.CurrentRow.Cells["dgvtxtvoucherTypeId"].Value.ToString());
                    infoVoucherType = spVoucherType.VoucherTypeView(decVoucherTypeId);
                    txtVoucherName.Text = infoVoucherType.VoucherTypeName;
                    cmbTypeOfVoucher.Text = infoVoucherType.TypeOfVoucher;
                    cmbMethodOfvoucherNumbering.Text = infoVoucherType.MethodOfVoucherNumbering;
                    txtNarration.Text = infoVoucherType.Narration;
                    txtDeclaration.Text = infoVoucherType.Declarartion;
                    cmbDotMatrix.SelectedValue = infoVoucherType.MasterId;
                    txtHeading1.Text = infoVoucherType.Heading1;
                    txtHeading2.Text = infoVoucherType.Heading2;
                    txtHeading3.Text = infoVoucherType.Heading3;
                    txtHeading4.Text = infoVoucherType.Heading4;
                    if (infoVoucherType.IsActive)
                    {
                        cbxActive.Checked = true;
                    }
                    else
                    {
                        cbxActive.Checked = false;
                    }
                    DataTable dtbl = new DataTable();
                    dtbl = spVoucherType.GetTaxIdForTaxSelection(decVoucherTypeId);
                    foreach (DataRow dr in dtbl.Rows)
                    {
                        string strTaxId = dr["taxId"].ToString();

                        for (int i = 0; i < inRowCount; i++)
                        {
                            if (dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString() == strTaxId)
                            {
                                dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = true;
                            }
                        }


                    }
                    if (spVoucherType.CheckForDefaultVoucherType(decVoucherTypeId) == false)
                    {
                        txtVoucherName.Enabled = true;
                        cmbTypeOfVoucher.Enabled = true;
                    }
                    else
                    {
                        txtVoucherName.Enabled = false;
                        cmbTypeOfVoucher.Enabled = false;
                    }
                    if (cmbTypeOfVoucher.Text == "Sales Return" || cmbTypeOfVoucher.Text == "Sales Invoice" || cmbTypeOfVoucher.Text == "Purchase Return" || cmbTypeOfVoucher.Text == "Purchase Invoice")
                    {
                        dgvApplicableTaxes.Enabled = true;

                    }
                    else
                    {
                        dgvApplicableTaxes.Enabled = false;
                    }
                }

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

        }
コード例 #15
0
ファイル: VoucherTypeSP.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to check method fo voucher numbering based on parameter
 /// </summary>
 /// <param name="voucherTypeId"></param>
 /// <returns></returns>
 public bool CheckMethodOfVoucherNumbering(decimal voucherTypeId)
 {
     VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
     SqlDataReader sdrreader = null;
     bool isAutomatic = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CheckMethodOfVoucherNumbering", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = voucherTypeId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             infoVoucherType.MethodOfVoucherNumbering = sdrreader["methodOfVoucherNumbering"].ToString();
         }
         if (infoVoucherType.MethodOfVoucherNumbering == "Automatic")
         {
             isAutomatic = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isAutomatic;
 }
コード例 #16
0
 /// <summary>
 /// Function to fill the details while calling from register or report
 /// </summary>
 public void FillRegisterOrReport()
 {
     PurchaseMasterInfo infoPurchaseMaster = new PurchaseMasterInfo();
     PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
     PurchaseOrderMasterInfo infoPurchaseOrderMaster = new PurchaseOrderMasterInfo();
     PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP();
     MaterialReceiptMasterInfo infoMaterialReceiptMaster = new MaterialReceiptMasterInfo();
     MaterialReceiptMasterSP spMaterialReceiptMaster = new MaterialReceiptMasterSP();
     VoucherTypeSP spVoucherType = new VoucherTypeSP();
     VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
     AccountLedgerSP spAccountLedger = new AccountLedgerSP();
     bool isPartyBalanceRef = false;
     try
     {
         isEditFill = true;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtVoucherNo.ReadOnly = true;
         infoPurchaseMaster = spPurchaseMaster.PurchaseMasterView(decPurchaseMasterId);
         strVoucherNo = infoPurchaseMaster.VoucherNo;
         decPurchaseInvoiceVoucherTypeId = infoPurchaseMaster.VoucherTypeId;
         decPurchaseInvoiceSuffixPrefixId = infoPurchaseMaster.SuffixPrefixId;
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPurchaseInvoiceVoucherTypeId);
         infoVoucherType = spVoucherType.VoucherTypeView(decPurchaseInvoiceVoucherTypeId);
         this.Text = infoVoucherType.VoucherTypeName;
         if (isAutomatic)
         {
             txtVoucherDate.Focus();
         }
         else
         {
             txtVoucherNo.Focus();
         }
         txtVoucherNo.Text = infoPurchaseMaster.InvoiceNo;
         txtVendorInvoiceNo.Text = infoPurchaseMaster.VendorInvoiceNo;
         dtpVoucherDate.Value = infoPurchaseMaster.Date;
         dtpInvoiceDate.Value = infoPurchaseMaster.VendorInvoiceDate;
         cmbCashOrParty.SelectedValue = infoPurchaseMaster.LedgerId;
         if (infoPurchaseMaster.PurchaseOrderMasterId == 0 && infoPurchaseMaster.MaterialReceiptMasterId == 0)
         {
             cmbPurchaseMode.SelectedItem = "NA";
         }
         else if (infoPurchaseMaster.PurchaseOrderMasterId != 0 && infoPurchaseMaster.MaterialReceiptMasterId == 0)
         {
             cmbPurchaseMode.SelectedItem = "Against PurchaseOrder";
             infoPurchaseOrderMaster = spPurchaseOrderMaster.PurchaseOrderMasterView(infoPurchaseMaster.PurchaseOrderMasterId);
             cmbVoucherType.SelectedValue = infoPurchaseOrderMaster.VoucherTypeId;
             OrderComboFill();
             cmbOrderNo.SelectedValue = infoPurchaseMaster.PurchaseOrderMasterId;
         }
         else if (infoPurchaseMaster.PurchaseOrderMasterId == 0 && infoPurchaseMaster.MaterialReceiptMasterId != 0)
         {
             cmbPurchaseMode.SelectedItem = "Against MaterialReceipt";
             infoMaterialReceiptMaster = spMaterialReceiptMaster.MaterialReceiptMasterView(infoPurchaseMaster.MaterialReceiptMasterId);
             cmbVoucherType.SelectedValue = infoMaterialReceiptMaster.VoucherTypeId;
             OrderComboFill();
             cmbOrderNo.SelectedValue = infoPurchaseMaster.MaterialReceiptMasterId;
         }
         cmbPurchaseAccount.SelectedValue = infoPurchaseMaster.PurchaseAccount;
         txtCreditPeriod.Text = infoPurchaseMaster.CreditPeriod;
         cmbCurrency.SelectedValue = infoPurchaseMaster.ExchangeRateId;
         txtNarration.Text = infoPurchaseMaster.Narration;
         lblAdditionalCostAmount.Text = Math.Round(infoPurchaseMaster.AdditionalCost, PublicVariables._inNoOfDecimalPlaces).ToString();
         lblTaxAmount.Text = Math.Round(infoPurchaseMaster.TotalTax, PublicVariables._inNoOfDecimalPlaces).ToString();
         txtTotalAmount.Text = Math.Round(infoPurchaseMaster.TotalAmount, PublicVariables._inNoOfDecimalPlaces).ToString();
         txtBillDiscount.Text = Math.Round(infoPurchaseMaster.BillDiscount, PublicVariables._inNoOfDecimalPlaces).ToString();
         txtLRNo.Text = infoPurchaseMaster.LrNo;
         txtTransportationCompany.Text = infoPurchaseMaster.TransportationCompany;
         txtGrandTotal.Text = Math.Round(infoPurchaseMaster.GrandTotal, PublicVariables._inNoOfDecimalPlaces).ToString();
         PurchaseDetailsFill();
         TaxGridFill();
         AdditionalCostGridFill();
         isPartyBalanceRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, decPurchaseInvoiceVoucherTypeId);
         if (isPartyBalanceRef)
         {
             cmbCashOrParty.Enabled = false;
         }
         else
         {
             cmbCashOrParty.Enabled = true;
         }
         isEditFill = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI55:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #17
0
ファイル: frmRejectionIn.cs プロジェクト: jsoques/openmiracle
        /// <summary>
        /// function to Rejection In updation
        /// </summary>
        public void RejectionInview()
        {
            decimal decRejectioInMasterId = 0;
            try
            {
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                isFromRejectionInRegister = true;
                RejectionInMasterSP SpRejectionInMaster = new RejectionInMasterSP();
                RejectionInMasterInfo InfoRejectionInMaster = new RejectionInMasterInfo();
                InfoRejectionInMaster = SpRejectionInMaster.RejectionInMasterView(decRejectionInIdToEdit);
                DeliveryNoteMasterSP SpDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteMasterInfo InfoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
                InfoDeliveryNoteMaster = SpDeliveryNoteMaster.DeliveryNoteMasterView(InfoRejectionInMaster.DeliveryNoteMasterId);
                strRejectionInVoucherNo = SpRejectionInMaster.GetRejectionInVoucherNo(InfoRejectionInMaster.RejectionInMasterId);
                decRejectionInVoucherTypeId = InfoRejectionInMaster.VoucherTypeId;
                decRejectionInSuffixPrefixId = InfoRejectionInMaster.SuffixPrefixId;
                strVoucherNo = InfoRejectionInMaster.VoucherNo;
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decRejectionInVoucherTypeId);

                if (!isAutomatic)
                {
                    txtRejectionInNo.ReadOnly = false;
                    txtRejectionInNo.Focus();
                }
                else
                {
                    txtRejectionInNo.ReadOnly = true;
                    txtDate.Focus();
                }
                txtRejectionInNo.Text = InfoRejectionInMaster.InvoiceNo;
                txtDate.Text = InfoRejectionInMaster.Date.ToString("dd-MMM-yyyy");
                dtpDate.Value = Convert.ToDateTime(txtDate.Text);
                cmbCashorParty.SelectedValue = InfoRejectionInMaster.LedgerId;
                cmbVoucherType.SelectedValue = InfoDeliveryNoteMaster.VoucherTypeId;
                cmbPricingLevel.SelectedValue = InfoRejectionInMaster.PricinglevelId;
                cmbDeliveryNoteNo.SelectedValue = InfoRejectionInMaster.DeliveryNoteMasterId;
                cmbSalesMan.SelectedValue = InfoRejectionInMaster.EmployeeId;
                cmbCurrency.SelectedValue = InfoRejectionInMaster.ExchangeRateId;
                txtTransportationCompany.Text = InfoRejectionInMaster.TransportationCompany;
                txtNarration.Text = InfoRejectionInMaster.Narration;
                txtLRNo.Text = InfoRejectionInMaster.LrNo;
                txtTotalAmount.Text = Convert.ToString(InfoRejectionInMaster.TotalAmount);
                RejectionInDetailsSP SpRejectionInDetails = new RejectionInDetailsSP();
                DataTable dtblRejectionInDetails = SpRejectionInDetails.RejectionInDetailsViewByRejectionInMasterId(decRejectionInIdToEdit);
                decRejectioInMasterId = Convert.ToDecimal(dtblRejectionInDetails.Rows[0]["voucherTypeId"].ToString());
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                infoVoucherType = spVoucherType.VoucherTypeView(decRejectioInMasterId);
                this.Text = infoVoucherType.VoucherTypeName;
                foreach (DataRow drRejectionInDetails in dtblRejectionInDetails.Rows)
                {
                    isDoCellValueChange = false;
                    DGVGodownComboFill();
                    dgvProduct.Rows.Add();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtProductId"].Value = drRejectionInDetails["productId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxDeliveryNoteDetailsId"].Value = drRejectionInDetails.ItemArray[2].ToString();
                    AssignProductDefaultValues(dgvProduct.Rows.Count - 1, Convert.ToDecimal(drRejectionInDetails.ItemArray[3].ToString()));
                    DGVBatchComboFill(dgvProduct.Rows.Count - 1, Convert.ToDecimal(drRejectionInDetails.ItemArray[3].ToString()));
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtQuantity"].Value = drRejectionInDetails["qty"].ToString();
                    isDoCellValueChange = true;
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drRejectionInDetails["unitId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drRejectionInDetails["unitconversionId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(drRejectionInDetails["godownId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbRack"].Value = Convert.ToDecimal(drRejectionInDetails["rackId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(drRejectionInDetails["batchId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtRate"].Value = drRejectionInDetails["rate"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtAmount"].Value = drRejectionInDetails["amount"].ToString();
                    dgvProduct.CurrentCell = null;
                }
                SerialNo();
                CalcTotalAmt();
                isDoCellValueChange = true;
                isDoAfterGridFill = true;
                isFromRejectionInRegister = false;
               
            }
            catch (Exception ex)
            {
                MessageBox.Show("RI:35" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);              
            }
        }
コード例 #18
0
ファイル: frmVoucherType.cs プロジェクト: jsoques/openmiracle
        /// <summary>
        /// save function
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                if (spVoucherType.VoucherTypeCheckExistence(txtVoucherName.Text.Trim(), 0) == false)
                {
                    infoVoucherType.VoucherTypeName = txtVoucherName.Text.Trim();
                    infoVoucherType.TypeOfVoucher = cmbTypeOfVoucher.Text;
                    infoVoucherType.MethodOfVoucherNumbering = cmbMethodOfvoucherNumbering.Text;
                    int inRowCount = dgvApplicableTaxes.RowCount;
                    for (int i = 0; i <= inRowCount - 1; i++)
                    {
                        if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                        {

                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                            {
                                isTax = bool.Parse(dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString());
                            }
                        }
                    }
                    infoVoucherType.IsTaxApplicable = isTax;
                    if (cbxActive.Checked)
                    {
                        IsActive = true;
                    }
                    infoVoucherType.IsActive = IsActive;
                    infoVoucherType.IsDefault = false;
                    infoVoucherType.Narration = txtNarration.Text.Trim();
                    infoVoucherType.Extra1 = string.Empty;
                    infoVoucherType.Extra2 = string.Empty;
                    infoVoucherType.MasterId = Convert.ToInt32(cmbDotMatrix.SelectedValue);
                    infoVoucherType.Declarartion = txtDeclaration.Text;
                    infoVoucherType.Heading1 = txtHeading1.Text;
                    infoVoucherType.Heading2 = txtHeading2.Text;
                    infoVoucherType.Heading3 = txtHeading3.Text;
                    infoVoucherType.Heading4 = txtHeading4.Text;

                    decVoucherTypeId = spVoucherType.VoucherTypeAddWithIdentity(infoVoucherType);
                    if (isTax)
                    {
                        for (int i = 0; i <= inRowCount - 1; i++)
                        {
                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                            {
                                if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                                {
                                    VoucherTypeTaxSP spVoucherTypeTax = new VoucherTypeTaxSP();
                                    VoucherTypeTaxInfo infoVoucherTypeTax = new VoucherTypeTaxInfo();
                                    infoVoucherTypeTax.VoucherTypeId = decVoucherTypeId;
                                    infoVoucherTypeTax.TaxId = Convert.ToDecimal(dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString());
                                    infoVoucherTypeTax.Extra1 = string.Empty;
                                    infoVoucherTypeTax.Extra2 = string.Empty;

                                    spVoucherTypeTax.VoucherTypeTaxAdd(infoVoucherTypeTax);
                                }
                            }

                        }

                    }
                    Messages.SavedMessage();
                    Clear();
                }
                else
                {
                    Messages.InformationMessage("Voucher name already exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT03:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #19
0
ファイル: frmSalesReturn.cs プロジェクト: jsoques/openmiracle
        /// <summary>
        /// FunctionToreturn fromregisterclick
        /// </summary>
        public void FillRegisterOrReport()
        {
            SalesReturnMasterSP spSalesReturnMaster = new SalesReturnMasterSP();
            SalesReturnDetailsSP spSalesReturnDetails = new SalesReturnDetailsSP();
            try
            {
                isFromOther = true;
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                CashOrPartyUnderSundryDebitorComboFill(cmbCashOrParty);
                DataTable dtblSalesMaster = new DataTable();
                DataTable dtblSalesReturnMaster = new DataTable();
                dtblSalesReturnMaster = spSalesReturnMaster.SalesReturnMasterViewBySalesReturnMasterId(salesReturnMasterId);
                decSalesReturnMasterId = salesReturnMasterId;
                DecSalesReturnVoucherTypeId = Convert.ToDecimal(dtblSalesReturnMaster.Rows[0]["voucherTypeId"].ToString());
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                infoVoucherType = spVoucherType.VoucherTypeView(DecSalesReturnVoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;
                if (infoVoucherType.MethodOfVoucherNumbering == "Manual")
                {
                    txtReturnNo.Text = dtblSalesReturnMaster.Rows[0]["invoiceNo"].ToString();
                    ManualReturnNo = dtblSalesReturnMaster.Rows[0]["invoiceNo"].ToString();
                    txtReturnNo.Enabled = true;
                }
                else
                {
                    txtReturnNo.Text = dtblSalesReturnMaster.Rows[0]["invoiceNo"].ToString();
                    txtReturnNo.Enabled = false;
                }
                if (dtblSalesReturnMaster.Rows.Count > 0)
                {
                    txtDate.Text = dtblSalesReturnMaster.Rows[0]["date"].ToString();
                    dtpDate.Value = Convert.ToDateTime(txtDate.Text);
                    if (dtblSalesReturnMaster.Rows[0]["grandTotal"].ToString() != string.Empty)
                    {
                        txtGrandTotal.Text = dtblSalesReturnMaster.Rows[0]["grandTotal"].ToString();
                    }
                    strVoucherNo = dtblSalesReturnMaster.Rows[0]["voucherNo"].ToString();
                    if (dtblSalesReturnMaster.Rows[0]["ledgerId"].ToString() != string.Empty)
                    {
                        cmbCashOrParty.SelectedValue = dtblSalesReturnMaster.Rows[0]["ledgerId"].ToString();
                    }
                    cmbVoucherTypeComboFill();
                    if (dtblSalesReturnMaster.Rows[0]["SMVoucherTypeId"].ToString() != string.Empty)
                    {
                        cmbVoucherType.SelectedValue = dtblSalesReturnMaster.Rows[0]["SMVoucherTypeId"].ToString();
                    }
                    else
                    {
                        cmbVoucherType.SelectedValue = 0;
                    }
                    cmbInvoiceComboFill();
                    if (dtblSalesReturnMaster.Rows[0]["pricingLevelId"].ToString() != string.Empty)
                    {
                        cmbPricingLevel.SelectedValue = dtblSalesReturnMaster.Rows[0]["pricingLevelId"].ToString();
                    }
                    if (dtblSalesReturnMaster.Rows[0]["salesAccount"].ToString() != string.Empty)
                    {
                        cmbSalesAccount.SelectedValue = dtblSalesReturnMaster.Rows[0]["salesAccount"].ToString();
                    }
                    if (dtblSalesReturnMaster.Rows[0]["employeeId"].ToString() != string.Empty)
                    {
                        cmbSalesMan.SelectedValue = dtblSalesReturnMaster.Rows[0]["employeeId"].ToString();
                    }
                    if (dtblSalesReturnMaster.Rows[0]["exchangeRateId"].ToString() != string.Empty)
                    {
                        cmbCurrency.SelectedValue = dtblSalesReturnMaster.Rows[0]["exchangeRateId"].ToString();
                    }
                    txtNarration.Text = dtblSalesReturnMaster.Rows[0]["narration"].ToString();
                    txtLRNo.Text = dtblSalesReturnMaster.Rows[0]["lrNo"].ToString();
                    txtTransportationComp.Text = dtblSalesReturnMaster.Rows[0]["transportationCompany"].ToString();
                    if (dtblSalesReturnMaster.Rows[0]["salesMasterId"].ToString() != string.Empty && Convert.ToDecimal(dtblSalesReturnMaster.Rows[0]["salesMasterId"].ToString()) != 0)
                    {
                        cmbInvoiceNo.SelectedValue = dtblSalesReturnMaster.Rows[0]["salesMasterId"].ToString();
                        decinvoiceno = Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString());
                        dtblSalesReturnMasterViewBySMID = spSalesReturnMaster.SalesReturnMasterViewBySalesMasterId(Convert.ToDecimal(dtblSalesReturnMaster.Rows[0]["salesMasterId"].ToString()));
                    }
                    isInvoiceFill = false;
                    if (dtblSalesReturnMaster.Rows[0]["voucherTypeId"].ToString() != string.Empty)
                    {
                        decSalesReturnVoucherTypeId = Convert.ToDecimal(dtblSalesReturnMaster.Rows[0]["voucherTypeId"].ToString());
                    }
                    TaxGridFill();
                    if (cmbInvoiceNo.SelectedValue != null)
                    {
                        infoSalesMaster = spSalesMaster.SalesMasterViewBySalesMasterId(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()));
                    }
                    DataTable dtblSalesReturnDetails = new DataTable();
                    dtblSalesReturnDetails = spSalesReturnDetails.SalesReturnDetailsViewBySalesReturnMasterId(salesReturnMasterId);
                    dtblSalesInvoice = dtblSalesReturnDetails;
                    foreach (DataRow drowDetails in dtblSalesReturnDetails.Rows)
                    {
                        dgvSalesReturn.Rows.Add();
                        if (drowDetails["salesReturnDetailsId"].ToString() != string.Empty)
                        {
                            dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["salesReturnDetailsId"].Value = Convert.ToDecimal(drowDetails["salesReturnDetailsId"].ToString());
                        }
                        if (drowDetails["salesDetailsId"].ToString() != string.Empty)
                        {
                            dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["salesDetailsId"].Value = drowDetails["salesDetailsId"].ToString();
                        }
                        else
                        {
                            dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["salesDetailsId"].Value = 0;
                        }
                        if (drowDetails["productId"].ToString() != string.Empty)
                        {
                            dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["productId"].Value = drowDetails["productId"].ToString();
                            DataTable dtbl = spSalesDetails.SalesReturnGrideFillNewByProductId(Convert.ToDecimal(drowDetails["productId"].ToString()));
                            foreach (DataRow drowDetails1 in dtbl.Rows)
                            {
                                if (drowDetails1["barcode"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextBarcode"].Value = drowDetails1["barcode"].ToString();
                                }
                                if (drowDetails1["productCode"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextProductCode"].Value = drowDetails1["productCode"].ToString();
                                }
                                if (drowDetails1["productName"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextProductName"].Value = drowDetails1["productName"].ToString();
                                }
                                if (cmbInvoiceNo.Visible == true)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbUnit"].ReadOnly = true;
                                }
                                if (drowDetails["unitId"].ToString() != string.Empty)
                                {
                                    decProductId = decimal.Parse(dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["productId"].Value.ToString());
                                    UnitComboFill(decProductId, dgvSalesReturn.Rows.Count - 2, dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbUnit"].ColumnIndex);
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbUnit"].Value = 1;
                                }
                                if (drowDetails["goDownId"].ToString() != string.Empty)
                                {
                                    DGVGodownComboFill();
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbGodown"].Value = Convert.ToDecimal(drowDetails["goDownId"].ToString());
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbGodown"].Value = 1;
                                }
                                if (drowDetails["rackId"].ToString() != string.Empty)
                                {
                                    RackComboFill(Convert.ToDecimal(dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbGodown"].Value.ToString()), dgvSalesReturn.Rows.Count - 2, dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbRack"].ColumnIndex);
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(drowDetails["rackId"].ToString());
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbRack"].Value = 1;
                                }
                                if (drowDetails["batchId"].ToString() != string.Empty)
                                {
                                    BatchComboFill(decProductId, dgvSalesReturn.Rows.Count - 2, dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbBatch"].ColumnIndex);
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString());
                                }
                                if (drowDetails["unitConversionId"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["unitConversionId"].Value = drowDetails["unitConversionId"].ToString();
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["unitConversionId"].Value = 0;
                                }
                                if (dtblSalesReturnMaster.Rows[0]["SMVoucherTypeId"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbBatch"].ReadOnly = true;
                                }
                                if (drowDetails["taxId"].ToString() != string.Empty)
                                {
                                    if (Convert.ToDecimal(drowDetails["taxId"].ToString()) != 0)
                                    {
                                        dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTaxId"].Value = Convert.ToDecimal(drowDetails["taxId"].ToString());
                                        dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbTax"].Value = Convert.ToDecimal(drowDetails["taxId"].ToString());
                                        strTaxRate = spSalesReturnMaster.TaxRateFindForTaxAmmountCalByTaxId(Convert.ToDecimal(drowDetails["taxId"].ToString()));
                                    }
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbTax"].Value = 1;
                                }
                                if (drowDetails["qty"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextQty"].Value = Math.Round(Convert.ToDecimal(drowDetails["qty"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    decQty = Math.Round(Convert.ToDecimal(drowDetails["qty"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextQty"].Value = 0.00;
                                    decQty = 0;
                                }
                                if (drowDetails["rate"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextRate"].Value = Math.Round(Convert.ToDecimal(drowDetails["rate"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    decRate = Convert.ToDecimal(drowDetails["rate"].ToString());
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextRate"].Value = 0.00;
                                    decRate = 0;
                                }
                                if (drowDetails["grossAmount"].ToString() != string.Empty)
                                {
                                    //dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].ReadOnly = false;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].Value = Math.Round(Convert.ToDecimal(drowDetails["grossAmount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    // dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].ReadOnly = true;
                                }
                                else
                                {
                                    //dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].ReadOnly = false;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].Value = 0.00;
                                    //dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextGrossValue"].ReadOnly = true;
                                }
                                if (drowDetails["discount"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextDiscountPercentage"].Value = 0.00;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextDiscountAmount"].Value = Math.Round(Convert.ToDecimal(drowDetails["discount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextDiscountAmount"].Value = 0.00;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextDiscountPercentage"].Value = 0.00;
                                }
                                if (drowDetails["netAmount"].ToString() != string.Empty)
                                {
                                    // dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].ReadOnly = false;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].Value = Math.Round(Convert.ToDecimal(drowDetails["netAmount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    //  dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].ReadOnly = true;
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].ReadOnly = false;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].Value = 0.00;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextNetValue"].ReadOnly = true;
                                }
                                if (drowDetails["taxAmount"].ToString() != string.Empty)
                                {
                                    //dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].ReadOnly = false;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].Value = Math.Round(Convert.ToDecimal(drowDetails["taxAmount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    //dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].ReadOnly = true;
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].Value = 0.00;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].ReadOnly = true;
                                }
                                if (drowDetails["amount"].ToString() != string.Empty)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextAmount1"].Value = Math.Round(Convert.ToDecimal(drowDetails["amount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextAmount1"].ReadOnly = true;
                                }
                                else
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextAmount1"].Value = 0.00;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextAmount1"].ReadOnly = true;
                                }
                                if (cmbInvoiceNo.Visible == true)
                                {
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextBarcode"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextProductCode"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextProductName"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextQty"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvCmbUnit"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvCmbGodown"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvCmbRack"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvCmbBatch"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextRate"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvTextDiscountPercentage"].ReadOnly = true;
                                    dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 1].Cells["dgvCmbTax"].ReadOnly = true;
                                }
                                dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["conversionRate"].Value = drowDetails["conversionRate"].ToString();
                                foreach (DataGridViewRow item1 in dgvSalesReturn2.Rows)
                                {
                                    if (item1.Cells["dgvTextTaxId"].Value != null)
                                    {
                                        if (dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvCmbTax"].Value.ToString() == item1.Cells["dgvTextTaxId"].Value.ToString())
                                        {
                                            item1.Cells["dgvTextAmount"].Value = dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["dgvTextTaxAmount"].Value;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            dgvSalesReturn.Rows[dgvSalesReturn.Rows.Count - 2].Cells["productId"].Value = 0;
                        }
                        TotalAmountCalculation();
                    }
                    if (!isSalesReturnFormActive)
                    {
                        dtblTaxGride = spSalesReturnBillTax.TaxDetailsViewBySalesReturnMasterId(salesReturnMasterId);
                        foreach (DataRow item1 in dtblTaxGride.Rows)
                        {
                            dgvSalesReturn2.Rows.Add();
                            dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextTaxName"].Value = item1["taxName"].ToString();
                            dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextAmount"].Value = Math.Round(Convert.ToDecimal(item1["taxAmount"].ToString()), PublicVariables._inNoOfDecimalPlaces);
                            dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvRate"].Value = item1["rate"].ToString();
                            dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextTaxId"].Value = item1["taxId"].ToString();
                        }
                    }
                    txtBillDiscount.Text = Convert.ToString(Math.Round(Convert.ToDecimal(dtblSalesReturnMaster.Rows[0]["discount"].ToString()), PublicVariables._inNoOfDecimalPlaces));
                    SerialNo2();

                    TotalBillTaxCalculation();
                    CessTaxamountCalculation();
                    TotalTaxAmtCalculation();
                    if (txtBillDiscount.Text != string.Empty)
                    {
                        decimal decDiscount = Convert.ToDecimal(txtBillDiscount.Text);
                        decimal decTotalAmt = Convert.ToDecimal(txtTotalAmount.Text);
                        if (decTotalAmt > decDiscount)
                        {
                            decimal decGrandTotal = decTotalAmt + decTotalBillTaxAmount + decTotalCessTaxamount - decDiscount;
                            decGrandTotal = Math.Round(decGrandTotal, PublicVariables._inNoOfDecimalPlaces);
                            txtGrandTotal.Text = decGrandTotal.ToString();
                        }
                    }
                    // SerialNo();
                }
                else
                {
                    MessageBox.Show("No record exists", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SR28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #20
0
ファイル: VoucherTypeSP.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to view type of voucher based on parameter
 /// </summary>
 /// <param name="decVoucherTypeId"></param>
 /// <returns></returns>
 public VoucherTypeInfo TypeOfVoucherBasedOnVoucherTypeId(decimal decVoucherTypeId)
 {
     SqlDataReader sdrReader = null;
     VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("TypeOfVoucherBasedOnVoucherTypeId", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         sqlcmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal).Value = decVoucherTypeId;
         sdrReader = sqlcmd.ExecuteReader();
         while (sdrReader.Read())
         {
             infoVoucherType.TypeOfVoucher = sdrReader["typeOfVoucher"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("VTSP:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         sdrReader.Close();
         sqlcon.Close();
     }
     return infoVoucherType;
 }
コード例 #21
0
 /// <summary>
 /// Function to fill the fields for edit or delete
 /// </summary>
 public void FillFunction()
 {
     try
     {
         ServiceDetailsSP spServiceDetails = new ServiceDetailsSP();
         ServiceMasterSP spServiceMaster = new ServiceMasterSP();
         ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo();
         LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo();
         decServiceMasterId = decMasterId;
         infoServiceMaster = spServiceMaster.ServiceMasterView(decServiceMasterId);
         infoVoucherType = spVoucherType.VoucherTypeView(infoServiceMaster.VoucherTypeId);
         this.Text = infoVoucherType.VoucherTypeName;
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(infoServiceMaster.VoucherTypeId);
         txtInvoiceNumber.ReadOnly = true;
         strVoucherNo = infoServiceMaster.VoucherNo.ToString();
         txtInvoiceNumber.Text = infoServiceMaster.InvoiceNo;
         txtCreditPeriod.Text = infoServiceMaster.CreditPeriod.ToString();
         strInvoiceNo = infoServiceMaster.InvoiceNo.ToString();
         decServiceSuffixPrefixId = Convert.ToDecimal(infoServiceMaster.SuffixPrefixId.ToString());
         DecServicetVoucherTypeId = Convert.ToDecimal(infoServiceMaster.VoucherTypeId.ToString());
         int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces;
         txtVoucherDate.Text = infoServiceMaster.Date.ToString("dd-MMM-yyyy");
         dtpVoucherDate.Value = Convert.ToDateTime(infoServiceMaster.Date);
         cmbCashParty.SelectedValue = infoServiceMaster.LedgerId;
         cmbServiceAC.SelectedValue = infoServiceMaster.ServiceAccount;
         cmbSalesman.SelectedValue = infoServiceMaster.EmployeeId;
         txtCustomer.Text = infoServiceMaster.Customer;
         txtNarration.Text = infoServiceMaster.Narration;
         DataTable dtblServiceDetails = new DataTable();
         dtblServiceDetails = spServiceDetails.ServiceDetailsViewWithMasterId(decServiceMasterId);
         for (int i = 0; i < dtblServiceDetails.Rows.Count; i++)
         {
             dgvServiceVoucher.Rows.Add();
             dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceDetailsId"].ToString());
             dgvServiceVoucher.Rows[i].Cells["dgvtxtServiceMasterId"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceMasterId"].ToString());
             dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceId"].ToString());
             dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value = dtblServiceDetails.Rows[i]["measure"].ToString();
             dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value = dtblServiceDetails.Rows[i]["amount"].ToString();
             decimal decDetailsId1 = Convert.ToDecimal(dtblServiceDetails.Rows[i]["serviceDetailsId"].ToString());
             decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, DecServicetVoucherTypeId);
             dgvServiceVoucher.Rows[i].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
         }
         cmbCurrency.SelectedValue = infoServiceMaster.ExchangeRateId;
         txtTotalAmount.Text = infoServiceMaster.TotalAmount.ToString();
         txtDiscount.Text = infoServiceMaster.Discount.ToString();
         txtGrandTotal.Text = infoServiceMaster.GrandTotal.ToString();
         infoPartyBalance = spPartyBalance.PartyBalanceViewByVoucherNoAndVoucherTypeId(DecServicetVoucherTypeId, strVoucherNo, infoServiceMaster.Date);
         decPartyBalanceId = infoPartyBalance.PartyBalanceId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 32 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #22
0
ファイル: VoucherTypeSP.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to view all VoucherTypes based on parameter
 /// </summary>
 /// <param name="voucherTypeId"></param>
 /// <returns></returns>
 public VoucherTypeInfo VoucherTypeView(decimal voucherTypeId)
 {
     VoucherTypeInfo vouchertypeinfo = new VoucherTypeInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = voucherTypeId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             vouchertypeinfo.VoucherTypeId = Convert.ToDecimal(sdrreader[0].ToString());
             vouchertypeinfo.VoucherTypeName = sdrreader[1].ToString();
             vouchertypeinfo.TypeOfVoucher = sdrreader[2].ToString();
             vouchertypeinfo.MethodOfVoucherNumbering = sdrreader[3].ToString();
             vouchertypeinfo.IsTaxApplicable = Convert.ToBoolean(sdrreader[4].ToString());
             vouchertypeinfo.Narration = sdrreader[5].ToString();
             vouchertypeinfo.ExtraDate = Convert.ToDateTime(sdrreader[6].ToString());
             vouchertypeinfo.Extra1 = sdrreader[7].ToString();
             vouchertypeinfo.Extra2 = sdrreader[8].ToString();
             vouchertypeinfo.IsActive = Convert.ToBoolean(sdrreader[9].ToString());
             vouchertypeinfo.MasterId = Convert.ToInt32(sdrreader[10].ToString());
             vouchertypeinfo.Declarartion = sdrreader[11].ToString();
             vouchertypeinfo.Heading1 = sdrreader[12].ToString();
             vouchertypeinfo.Heading2 = sdrreader[13].ToString();
             vouchertypeinfo.Heading3 = sdrreader[14].ToString();
             vouchertypeinfo.Heading4 = sdrreader[15].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return vouchertypeinfo;
 }
コード例 #23
0
 /// <summary>
 /// Fill function for edit
 /// </summary>
 public void FillRejectionOutReportForEdit()
 {
     try
     {
         dgvProduct.Rows.Clear();
         isDoCellValueChange = false;
         isFromRegister = true;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtRejectionOutNo.ReadOnly = true;
         infoRejectionOutMaster = spRejectionOutMaster.RejectionOutMasterView(decRejectionOutId);
         MaterialReceiptMasterSP SpMaterialReceiptMaster = new MaterialReceiptMasterSP();
         MaterialReceiptMasterInfo InfoMaterialReceiptMaster = new MaterialReceiptMasterInfo();
         VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
         InfoMaterialReceiptMaster = SpMaterialReceiptMaster.MaterialReceiptMasterView(infoRejectionOutMaster.MaterialReceiptMasterId);
         strRejectionOutVoucherNo = spRejectionOutMaster.GetRejectionOutVoucherNo(infoRejectionOutMaster.RejectionOutMasterId);
         txtRejectionOutNo.Text = infoRejectionOutMaster.InvoiceNo;
         strVoucherNo = infoRejectionOutMaster.VoucherNo.ToString();
         decRejectionOutSuffixPrefixId = Convert.ToDecimal(infoRejectionOutMaster.SuffixPrefixId);
         decRejectionOutVoucherTypeId = Convert.ToDecimal(infoRejectionOutMaster.VoucherTypeId);
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decRejectionOutVoucherTypeId);
         infoVoucherType = spVoucherType.VoucherTypeView(decRejectionOutVoucherTypeId);
         this.Text = infoVoucherType.VoucherTypeName;
         if (!isAutomatic)
         {
             txtRejectionOutNo.ReadOnly = false;
             txtRejectionOutNo.Focus();
         }
         else
         {
             txtRejectionOutNo.ReadOnly = true;
             txtDate.Focus();
         }
         decRejectionOutTypeId = decRejectionOutVoucherTypeId;
         txtDate.Text = infoRejectionOutMaster.Date.ToString("dd-MMM-yyyy");
         cmbCashOrParty.SelectedValue = infoRejectionOutMaster.LedgerId;
         cmbVoucherType.SelectedValue = InfoMaterialReceiptMaster.VoucherTypeId;
         cmbMaterialReceiptNo.SelectedValue = Convert.ToDecimal(infoRejectionOutMaster.MaterialReceiptMasterId.ToString());
         txtTransportationCompany.Text = infoRejectionOutMaster.TransportationCompany;
         txtNarration.Text = infoRejectionOutMaster.Narration;
         cmbCurrency.SelectedValue = infoRejectionOutMaster.ExchangeRateId;
         txtTotalAmount.Text = infoRejectionOutMaster.TotalAmount.ToString();
         txtLrNo.Text = infoRejectionOutMaster.LrNo.ToString();
         DataTable dtblRejectionOut = spRejectionOutDetails.RejectionOutDetailsViewByRejectionOutMasterId(infoRejectionOutMaster.RejectionOutMasterId);
         for (int i = 0; i < dtblRejectionOut.Rows.Count; i++)
         {
             dgvProduct.Rows.Add();
             GodownComboFill();
             isAmountcalc = false;
             decRejectionOutDetailId = Convert.ToDecimal(dtblRejectionOut.Rows[i]["rejectionOutDetailsId"].ToString());
             dgvProduct.Rows[i].Cells["dgvtxtSlNo"].Value = dtblRejectionOut.Rows[i]["slno"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtProductId"].Value = dtblRejectionOut.Rows[i]["productId"].ToString();
             ProductDefaultValues(i, Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString()));
             BatchComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString()), i, dgvProduct.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
             dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["batchId"].ToString());
             dgvProduct.Rows[i].Cells["dgvtxtQty"].Value = dtblRejectionOut.Rows[i]["qty"].ToString();
             UnitComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString()), i, dgvProduct.Rows[i].Cells["dgvcmbUnit"].ColumnIndex);
             isDoCellValueChange = true;
             isDoAfterGridFill = true;
             isValueChange = true;
             isAmountcalc = true;
             dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["unitId"].ToString());
             isDoCellValueChange = false;
             isDoAfterGridFill = false;
             isValueChange = false;
             dgvProduct.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["godownId"].ToString());
             RackComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["godownId"].ToString()), dgvProduct, i);
             dgvProduct.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["rackId"].ToString());
             dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = dtblRejectionOut.Rows[i]["barcode"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtRejectionOutDetailsId"].Value = decRejectionOutDetailId;
             dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = dtblRejectionOut.Rows[i]["rate"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtAmount"].Value = dtblRejectionOut.Rows[i]["amount"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtunitConversionId"].Value = dtblRejectionOut.Rows[i]["UnitConversionId"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtconversionRate"].Value = dtblRejectionOut.Rows[i]["conversionRate"].ToString();
             dgvProduct.Rows[i].Cells["dgvtxtmaterialReceiptDetailsId"].Value = dtblRejectionOut.Rows[i]["materialReceiptDetailsId"].ToString();
         }
         TotalAmount();
         isAmountcalc = true;
         isDoAfterGridFill = true;
         isFromRegister = false;
         isDoCellValueChange = true;
         isValueChange = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RO36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #24
0
ファイル: VoucherTypeSP.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to insert values to table and return id 
 /// </summary>
 /// <param name="vouchertypeinfo"></param>
 /// <returns></returns>
 public decimal VoucherTypeAddWithIdentity(VoucherTypeInfo vouchertypeinfo)
 {
     decimal decVoucherTypeId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeAddWithIdentity", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeName", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.VoucherTypeName;
         sprmparam = sccmd.Parameters.Add("@typeOfVoucher", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.TypeOfVoucher;
         sprmparam = sccmd.Parameters.Add("@methodOfVoucherNumbering", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.MethodOfVoucherNumbering;
         sprmparam = sccmd.Parameters.Add("@isTaxApplicable", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsTaxApplicable;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsActive;
         sprmparam = sccmd.Parameters.Add("@IsDefault", SqlDbType.Bit);
         sprmparam.Value = vouchertypeinfo.IsDefault;
         sprmparam = sccmd.Parameters.Add("@masterId", SqlDbType.Int);
         sprmparam.Value = vouchertypeinfo.MasterId;
         sprmparam = sccmd.Parameters.Add("@declaration", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Declarartion;
         sprmparam = sccmd.Parameters.Add("@heading1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading1;
         sprmparam = sccmd.Parameters.Add("@heading2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading2;
         sprmparam = sccmd.Parameters.Add("@heading3", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading3;
         sprmparam = sccmd.Parameters.Add("@heading4", SqlDbType.VarChar);
         sprmparam.Value = vouchertypeinfo.Heading4;
         object obj = sccmd.ExecuteScalar();
         if (obj != null)
         {
             decVoucherTypeId = Convert.ToDecimal(obj.ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decVoucherTypeId;
 }
コード例 #25
0
ファイル: frmVoucherType.cs プロジェクト: jsoques/openmiracle
        /// <summary>
        /// update function
        /// </summary>
        public void EditFunction()
        {
            try
            {
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                VoucherTypeTaxSP spVoucherTypeTax = new VoucherTypeTaxSP();
                VoucherTypeTaxInfo infoVoucherTypeTax = new VoucherTypeTaxInfo();

                if (spVoucherType.VoucherTypeCheckExistence(txtVoucherName.Text.Trim(), decVoucherTypeId) == false)
                {
                    if (spVoucherType.VoucherTypeChechReferences(decVoucherTypeId) == false)
                    {
                        infoVoucherType.VoucherTypeId = decVoucherTypeId;
                        infoVoucherType.VoucherTypeName = txtVoucherName.Text.Trim();
                        infoVoucherType.TypeOfVoucher = cmbTypeOfVoucher.Text;
                        infoVoucherType.MethodOfVoucherNumbering = cmbMethodOfvoucherNumbering.Text;
                        infoVoucherType.Narration = txtNarration.Text.Trim();
                        if (cbxActive.Checked)
                        {
                            IsActive = true;
                        }
                        infoVoucherType.IsActive = IsActive;
                        int inRowCount = dgvApplicableTaxes.RowCount;
                        for (int i = 0; i <= inRowCount - 1; i++)
                        {

                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null && dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                            {
                                isTax = bool.Parse(dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString());

                            }
                        }
                        infoVoucherType.IsTaxApplicable = isTax;
                        infoVoucherType.IsDefault = false;
                        infoVoucherType.Extra1 = string.Empty;
                        infoVoucherType.Extra2 = string.Empty;
                        infoVoucherType.MasterId = int.Parse(cmbDotMatrix.SelectedValue.ToString());
                        infoVoucherType.Declarartion = txtDeclaration.Text;
                        infoVoucherType.Heading1 = txtHeading1.Text;
                        infoVoucherType.Heading2 = txtHeading2.Text;
                        infoVoucherType.Heading3 = txtHeading3.Text;
                        infoVoucherType.Heading4 = txtHeading4.Text;
                        if (spVoucherType.CheckForDefaultVoucherType(decVoucherTypeId) == false)
                        {

                            spVoucherType.VoucherTypeEdit(infoVoucherType);
                        }
                        else
                        {

                            spVoucherType.VoucherTypeEditForDefaultVouchers(infoVoucherType);

                        }
                        //------------------------------------- Delete And Add Tax details From VoucherTypeTax Using VoucherTypeId-------------------------------//
                        spVoucherTypeTax.DeleteVoucherTypeTaxUsingVoucherTypeId(decVoucherTypeId);
                        if (isTax)
                        {
                            for (int i = 0; i <= inRowCount - 1; i++)
                            {
                                if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null && dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                                {
                                    infoVoucherTypeTax.VoucherTypeId = decVoucherTypeId;
                                    infoVoucherTypeTax.TaxId = Convert.ToDecimal(dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString());
                                    infoVoucherTypeTax.Extra1 = string.Empty;
                                    infoVoucherTypeTax.Extra2 = string.Empty;

                                    spVoucherTypeTax.VoucherTypeTaxAdd(infoVoucherTypeTax);
                                }
                            }
                        }

                        //-----------------------------------------------------------Deleted And Added--------------------------------------------------------//
                        Messages.UpdatedMessage();
                        Clear();
                    }
                    else
                    {
                        Messages.InformationMessage("You can't update,voucher already in use");
                    }
                }
                else
                {
                    Messages.InformationMessage("Voucher name already exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT04:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #26
0
        /// <summary>
        /// Function to fill the details while calling from register or report 
        /// </summary>
        public void FillRegisterOrReport()
        {
            StockJournalMasterSP spStockJournalMaster = new StockJournalMasterSP();
            StockJournalDetailsSP spStockJournalDetails = new StockJournalDetailsSP();
            StockJournalMasterInfo infoStockJournalMaster = new StockJournalMasterInfo();
            StockJournalDetailsInfo infoStockJournalDetails = new StockJournalDetailsInfo();
            AdditionalCostSP spAdditionalCost = new AdditionalCostSP();
            VoucherTypeSP spVoucherType = new VoucherTypeSP();
            try
            {

                isFillMode = true;
                btnSave.Text = "Update";
                cmbFinishedGoods.Enabled = false;
                txtQty.Enabled = false;
                btnAdd.Enabled = false;
                dgvConsumption.Rows.Clear();
                dgvProduction.Rows.Clear();
                dgvAdditionalCost.Rows.Clear();
                DataTable dtblMaster = spStockJournalMaster.StockJournalMasterFillForRegisterOrReport(decStockJournalMasterIdForEdit);
                StockJournalVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString());
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                infoVoucherType = spVoucherType.VoucherTypeView(StockJournalVoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;
                txtDate.Text = dtblMaster.Rows[0]["date"].ToString();
                strVoucherNo = dtblMaster.Rows[0]["voucherNo"].ToString();
                decSuffixPrefixId = Convert.ToDecimal(dtblMaster.Rows[0]["suffixPrefixId"].ToString());
                decVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString());
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(StockJournalVoucherTypeId);
                dtpDate.Value = Convert.ToDateTime(txtDate.Text);
                txtNarration.Text = dtblMaster.Rows[0]["narration"].ToString();
                cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());

                if (dtblMaster.Rows[0]["extra1"].ToString() == "Manufacturing")
                {
                    rbtnManufacturing.Checked = true;
                }
                if (dtblMaster.Rows[0]["extra1"].ToString() == "Transfer")
                {
                    rbtnTransfer.Checked = true;
                }
                if (dtblMaster.Rows[0]["extra1"].ToString() == "Stock Out")
                {
                    rbtnStockOut.Checked = true;
                }
                txtVoucherNo.Text = dtblMaster.Rows[0]["invoiceNo"].ToString();

                DataSet dsDetails = spStockJournalDetails.StockJournalDetailsForRegisterOrReport(decStockJournalMasterIdForEdit);

                DataTable dtblConsumption = dsDetails.Tables[0];
                if (dsDetails.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < dtblConsumption.Rows.Count; i++)
                    {
                        dgvConsumption.Rows.Add();
                        dgvConsumption.Rows[i].HeaderCell.Value = string.Empty;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["stockJournalDetailsId"].ToString());
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value = dtblConsumption.Rows[i]["slno"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].Value = dtblConsumption.Rows[i]["barcode"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = dtblConsumption.Rows[i]["productCode"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].Value = dtblConsumption.Rows[i]["productName"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value = dtblConsumption.Rows[i]["productId"].ToString();
                        IsSetGridValueChange = true;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionQty"].Value = dtblConsumption.Rows[i]["qty"].ToString();
                        IsSetGridValueChange = false;
                        dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["godownId"].ToString());
                        dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["rackId"].ToString());
                        if (dtblConsumption.Rows[i]["batchId"] != null && dtblConsumption.Rows[i]["batchId"].ToString() != "0")
                        {
                            dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["batchId"].ToString());
                        }
                        else
                        {
                            dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = string.Empty;
                        }
                        IsSetGridValueChange = true;
                        dgvConsumption.Rows[i].Cells["dgvcmbConsumptionunitId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["unitId"].ToString());
                        IsSetGridValueChange = false;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionUnitConversionId"].Value = dtblConsumption.Rows[i]["unitConversionId"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].ReadOnly = true;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].ReadOnly = true;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].ReadOnly = true;
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value = dtblConsumption.Rows[i]["rate"].ToString();
                        dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value = dtblConsumption.Rows[i]["amount"].ToString();
                        dgvConsumption.Rows[i].HeaderCell.Value = "";
                    }
                }
                DataTable dtblProduction = dsDetails.Tables[1];
                for (int i = 0; i < dtblProduction.Rows.Count; i++)
                {
                    dgvProduction.Rows.Add();
                    dgvProduction.Rows[i].HeaderCell.Value = string.Empty;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["stockJournalDetailsId"].ToString());
                    dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value = dtblProduction.Rows[i]["slno"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].Value = dtblProduction.Rows[i]["barcode"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = dtblProduction.Rows[i]["productCode"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].Value = dtblProduction.Rows[i]["productName"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value = dtblProduction.Rows[i]["productId"].ToString();
                    IsSetGridValueChange = true;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionQty"].Value = dtblProduction.Rows[i]["qty"].ToString();
                    IsSetGridValueChange = false;
                    if (rbtnManufacturing.Checked)
                    {
                        cmbFinishedGoods.SelectedValue = dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value;
                        if (cmbFinishedGoods.SelectedValue != null)
                        {
                            cmbFinishedGoods.Enabled = true;
                            txtQty.Enabled = true;
                            btnAdd.Enabled = true;
                            txtQty.Text = dtblProduction.Rows[i]["qty"].ToString();
                        }

                    }
                    dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["godownId"].ToString());
                    dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["rackId"].ToString());
                    if (dtblProduction.Rows[i]["batchId"] != null && dtblProduction.Rows[i]["batchId"].ToString() != string.Empty)
                    {
                        dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["batchId"].ToString());
                    }
                    else
                    {
                        dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = string.Empty;
                    }
                    IsSetGridValueChange = true;
                    dgvProduction.Rows[i].Cells["dgvcmbProductionunitId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["unitId"].ToString());
                    IsSetGridValueChange = false;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionUnitConversionId"].Value = dtblProduction.Rows[i]["unitConversionId"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].ReadOnly = true;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].ReadOnly = true;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].ReadOnly = true;
                    dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value = dtblProduction.Rows[i]["rate"].ToString();
                    dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value = dtblProduction.Rows[i]["amount"].ToString();

                }
                DataSet dsAdditionalCost = spAdditionalCost.StockJournalAdditionalCostForRegisteOrReport(strVoucherNo, decVoucherTypeId);
                if (dsAdditionalCost.Tables[0].Rows.Count > 0)
                {
                    DataTable dtblCashOrBank = dsAdditionalCost.Tables[0];
                    cmbCashOrBank.SelectedValue = Convert.ToDecimal(dtblCashOrBank.Rows[0]["ledgerId"]);
                }
                if (dsAdditionalCost.Tables[1].Rows.Count > 0)
                {
                    DataTable dtblIndirectExpenses = dsAdditionalCost.Tables[1];

                    int inRowIndexAdditional = 0;
                    for (int i = 0; i < dtblIndirectExpenses.Rows.Count; i++)
                    {
                        dgvAdditionalCost.Rows.Add();
                        dgvAdditionalCost.Rows[i].HeaderCell.Value = string.Empty;
                        dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostSlNo"].Value = ++inRowIndexAdditional;

                        dgvAdditionalCost.Rows[i].Cells["dgvcmbAdditionalCostLedger"].Value = Convert.ToDecimal(dtblIndirectExpenses.Rows[i]["ledgerId"].ToString());
                        dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostAmount"].Value = dtblIndirectExpenses.Rows[i]["debit"].ToString();
                    }
                }
                grandTotalAmountCalculationConsumption();
                grandTotalAmountCalculationProduction();
                TotalAdditionalCostAmount();
                btnDelete.Enabled = true;
                if (isAutomatic)
                {
                    txtVoucherNo.ReadOnly = true;
                }
                else
                {
                    txtVoucherNo.ReadOnly = false;
                }
                gbxTransactionType.Enabled = false;
                isFillMode = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("SJ:50" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #27
0
 /// <summary>
 /// Function to fill the order no combobox  based on the deliverymode
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbDeliveryMode_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmbDeliveryMode.SelectedIndex != 0)
         {
             cmbOrderNo.Enabled = true;
             DataTable dtbl = new DataTable();
             if (cmbDeliveryMode.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 decVoucherTypes = Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString());
             }
             if (cmbVoucherType.SelectedValue != null)
             {
                 infoVoucherType = spVoucherType.TypeOfVoucherBasedOnVoucherTypeId(Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString()));
                 strTypeOfVoucher = infoVoucherType.TypeOfVoucher;
                 AgainstOrderComboFill();
             }
         }
         else
         {
             cmbOrderNo.DataSource = null;
             cmbOrderNo.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREP12: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }