private void txtTotal_EditValueChanged(object sender, EventArgs e) { Qualifier.frmQualifier qul = new Qualifier.frmQualifier(); decimal dAmt = Convert.ToDecimal(CommFun.IsNullCheck(txtTotal.Text, CommFun.datatypes.vartypenumeric)); decimal dNAmt = 0; decimal dTaxAmt = 0; decimal dVATAmt = 0; if (qul.Execute("S", ref dAmt, ref QualVBC, ref dNAmt, false, "", true, ref dTaxAmt, DateTime.Now, ref dVATAmt) == true) { DataRow dr; QualTrans.Rows.Clear(); foreach (Qualifier.cRateQualR d in QualVBC) { dr = QualTrans.NewRow(); dr["BillRegId"] = m_iRegBillId; dr["QualifierId"] = d.RateID.ToString().Trim('S'); dr["Expression"] = d.Expression; dr["ExpPer"] = d.ExpPer; dr["Add_Less_Flag"] = d.Add_Less_Flag; dr["SurCharge"] = d.SurPer; dr["EDCess"] = d.EDPer; dr["Amount"] = d.Amount; dr["ExpValue"] = d.ExpValue; dr["ExpPerValue"] = d.ExpPerValue; dr["EDValue"] = d.EDValue; dr["SurValue"] = d.SurValue; QualTrans.Rows.Add(dr); } txtQTotal.Text = CommFun.FormatNum1(dNAmt.ToString(), CommFun.g_iCurrencyDigit); txtNAmt.Text = CommFun.FormatNum1(dNAmt.ToString(), CommFun.g_iCurrencyDigit);; } }
void butQual_DoubleClick(object sender, EventArgs e) { int iRowid = gridView1.FocusedRowHandle; DataView dv = new DataView(m_tQualifier); dv.RowFilter = "RowId = " + iRowid; DataTable dt = new DataTable(); if (dv.ToTable() != null) { dt = dv.ToTable(); } Collection QualVBC = new Collection(); for (int i = 0; i < dt.Rows.Count; i++) { cRateQualR RAQual = new cRateQualR(); RAQual.Add_Less_Flag = CommFun.IsNullCheck(dt.Rows[i]["Add_Less_Flag"], CommFun.datatypes.vartypestring).ToString(); RAQual.Amount = 0; RAQual.Expression = CommFun.IsNullCheck(dt.Rows[i]["Expression"], CommFun.datatypes.vartypestring).ToString(); RAQual.RateID = Convert.ToInt32(CommFun.IsNullCheck(dt.Rows[i]["QualifierId"], CommFun.datatypes.vartypenumeric)); RAQual.ExpPer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["ExpPer"], CommFun.datatypes.vartypenumeric)); RAQual.NetPer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["Net"], CommFun.datatypes.vartypenumeric)); RAQual.SurPer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["SurCharge"], CommFun.datatypes.vartypenumeric)); RAQual.EDPer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["EDCess"], CommFun.datatypes.vartypenumeric)); RAQual.HEDPer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["HEDCess"], CommFun.datatypes.vartypenumeric)); RAQual.TaxablePer = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["Taxable"], CommFun.datatypes.vartypenumeric)); RAQual.TaxableValue = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[i]["TaxableValue"], CommFun.datatypes.vartypenumeric)); QualVBC.Add(RAQual, RAQual.RateID.ToString(), null, null); } Qualifier.frmQualifier qul = new Qualifier.frmQualifier(); decimal dAmt = 0; decimal dNAmt = 0; decimal dTaxAmt = 0; decimal dVATAmt = 0; if (qul.Execute("B", ref dAmt, ref QualVBC, ref dNAmt, true, "", true, ref dTaxAmt, DateTime.Now, ref dVATAmt) == true) { DataRow[] drow = m_tQualifier.Select("RowId=" + iRowid + ""); for (int i = 0; i <= drow.Length - 1; i++) { m_tQualifier.Rows.Remove(drow[i]); } foreach (Qualifier.cRateQualR d in QualVBC) { DataRow dr = m_tQualifier.NewRow(); dr["RowId"] = iRowid; dr["QualifierId"] = d.RateID; dr["Expression"] = d.Expression; dr["ExpPer"] = d.ExpPer; dr["Net"] = d.NetPer; dr["Add_Less_Flag"] = d.Add_Less_Flag; dr["SurCharge"] = d.SurPer; dr["EDCess"] = d.EDPer; dr["HEDCess"] = d.HEDPer; dr["Taxable"] = d.TaxablePer; dr["TaxableValue"] = d.TaxableValue; m_tQualifier.Rows.Add(dr); } } }
void txtTax_DoubleClick(object sender, EventArgs e) { int iReceiptId = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "ReceiptTypeId")); int iOthId = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "OtherCostId")); DataView dv = new DataView(m_tQdT); dv.RowFilter = "FlatId = " + m_iFlatId + " And PaymentSchId = " + m_iPayShId + " And ReceiptTypeId = " + iReceiptId + " And OtherCostId = " + iOthId; DataTable dtQ = new DataTable(); dtQ = dv.ToTable(); DataTable dtTQ = new DataTable(); if (dtQ.Rows.Count > 0) { dtTQ = dtQ.GetChanges().Copy(); } else { dtTQ = dtQ.Clone(); } Collection QualVBC = new Collection(); if (dtQ.Rows.Count > 0) { for (int i = 0; i <= dtQ.Rows.Count - 1; i++) { cRateQualR RAQual = new cRateQualR(); RAQual.RateID = Convert.ToInt32(CommFun.IsNullCheck(dtQ.Rows[i]["QualifierId"], CommFun.datatypes.vartypenumeric)); RAQual.ExpPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["ExpPer"], CommFun.datatypes.vartypenumeric)); RAQual.NetPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["NetPer"], CommFun.datatypes.vartypenumeric)); RAQual.SurPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["SurCharge"], CommFun.datatypes.vartypenumeric)); RAQual.EDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["EDCess"], CommFun.datatypes.vartypenumeric)); RAQual.HEDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["HEDPer"], CommFun.datatypes.vartypenumeric)); RAQual.TaxablePer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["TaxablePer"], CommFun.datatypes.vartypenumeric)); RAQual.Add_Less_Flag = dtQ.Rows[i]["Add_Less_Flag"].ToString(); RAQual.Amount = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[i]["Amount"], CommFun.datatypes.vartypenumeric)); RAQual.Expression = dtQ.Rows[i]["Expression"].ToString(); QualVBC.Add(RAQual, RAQual.RateID.ToString(), null, null); } } else { for (int k = 0; k < dtQ.Rows.Count; k++) { bool bService = Convert.ToBoolean(CommFun.IsNullCheck(dtQ.Rows[k]["Service"], CommFun.datatypes.varTypeBoolean)); int iQualId = Convert.ToInt32(CommFun.IsNullCheck(dtQ.Rows[k]["QualifierId"], CommFun.datatypes.vartypenumeric)); DataTable dtTDS = new DataTable(); if (Convert.ToInt32(CommFun.IsNullCheck(dtQ.Rows[k]["QualTypeId"], CommFun.datatypes.vartypenumeric)) == 2) { if (bService == true) { dtTDS = ReceiptDetailBL.GetSTSettings("G", m_dDate); } else { dtTDS = ReceiptDetailBL.GetSTSettings("F", m_dDate); } } else { dtTDS = ReceiptDetailBL.GetQual(iQualId, m_dDate); } cRateQualR RAQual = new cRateQualR(); if (dtTDS.Rows.Count > 0) { RAQual.RateID = iQualId; RAQual.ExpPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["ExpPer"], CommFun.datatypes.vartypenumeric)); RAQual.NetPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["Net"], CommFun.datatypes.vartypenumeric)); RAQual.SurPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["SurCharge"], CommFun.datatypes.vartypenumeric)); RAQual.EDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["EDCess"], CommFun.datatypes.vartypenumeric)); RAQual.HEDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["HEDCess"], CommFun.datatypes.vartypenumeric)); RAQual.TaxablePer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["Taxable"], CommFun.datatypes.vartypenumeric)); } DataTable dtQ1 = new DataTable(); dtQ1 = CRM.DataLayer.PaymentScheduleDL.GetQual(Convert.ToInt32(iQualId), m_dDate, "B"); //dtQ1 = ReceiptDetailBL.QualifierSelect(iQualId, "B", m_dDate); if (dtQ1.Rows.Count > 0) { RAQual.Add_Less_Flag = dtQ1.Rows[0]["Add_Less_Flag"].ToString(); RAQual.Amount = 0; RAQual.Expression = dtQ1.Rows[0]["Expression"].ToString(); } QualVBC.Add(RAQual, RAQual.RateID.ToString(), null, null); } } decimal dQNetAmt = 0; decimal dTaxAmt = 0; decimal dVATAmt = 0; decimal dQBaseAmt = Convert.ToDecimal(CommFun.IsNullCheck(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidGrossAmount"), CommFun.datatypes.vartypenumeric)); Qualifier.frmQualifier qul = new Qualifier.frmQualifier(); if (qul.Execute("B", ref dQBaseAmt, ref QualVBC, ref dQNetAmt, true, "", true, ref dTaxAmt, m_dDate, ref dVATAmt) == true) { int i = 0; while (i < m_tQdT.Rows.Count) { DataRow dr = m_tQdT.Rows[i]; if (Convert.ToInt32(dr["FlatId"]) == m_iFlatId && Convert.ToInt32(dr["PaymentSchId"]) == m_iPayShId && Convert.ToInt32(dr["ReceiptTypeId"]) == iReceiptId && Convert.ToInt32(dr["OtherCostId"]) == iOthId) { m_tQdT.Rows.Remove(dr); } else { i++; } } foreach (Qualifier.cRateQualR d in QualVBC) { DataRow dr1 = m_tQdT.NewRow(); dr1["FlatId"] = m_iFlatId; dr1["PaymentSchId"] = m_iPayShId; dr1["QualifierId"] = d.RateID; DataView dv1 = new DataView(dtTQ); dv1.RowFilter = "QualifierId=" + d.RateID + ""; if (dv1.ToTable().Rows.Count > 0) { dr1["QualTypeId"] = dv1.ToTable().Rows[0]["QualTypeId"]; dr1["Service"] = dv1.ToTable().Rows[0]["Service"]; } dr1["Expression"] = d.Expression; dr1["ExpPer"] = d.ExpPer; dr1["NetPer"] = d.NetPer; dr1["Add_Less_Flag"] = d.Add_Less_Flag; dr1["SurCharge"] = d.SurPer; dr1["EDCess"] = d.EDPer; dr1["HEDPer"] = d.HEDPer; dr1["ExpValue"] = d.ExpValue; dr1["ExpPerValue"] = d.ExpPerValue; dr1["SurValue"] = d.SurValue; dr1["EDValue"] = d.EDValue; dr1["Amount"] = d.Amount; dr1["ReceiptTypeId"] = iReceiptId; dr1["OtherCostId"] = iOthId; dr1["TaxablePer"] = d.TaxablePer; dr1["TaxableValue"] = d.TaxableValue; m_tQdT.Rows.Add(dr1); } grdViewReceipt.SetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidTaxAmount", dTaxAmt); grdViewReceipt.SetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidNetAmount", dQNetAmt); } }
void txtGross_EditValueChanged(object sender, EventArgs e) { TextEdit editor = (TextEdit)sender; DataTable dtQ = new DataTable(); DataTable dtTQ = new DataTable(); bool bService = false; int iQualId = 0; decimal dGross = Convert.ToDecimal(CommFun.IsNullCheck(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "GrossAmount"), CommFun.datatypes.vartypenumeric)); decimal dAmt = dGross - Convert.ToDecimal(CommFun.IsNullCheck(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidAmount"), CommFun.datatypes.vartypenumeric)); //decimal dNetAmt = Convert.ToDecimal(CommFun.IsNullCheck(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "NetAmount"), CommFun.datatypes.vartypenumeric)) - Convert.ToDecimal(CommFun.IsNullCheck(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "HPaidNetAmount"), CommFun.datatypes.vartypenumeric)); if (Convert.ToDecimal(CommFun.IsNullCheck(editor.EditValue, CommFun.datatypes.vartypenumeric)) > dAmt) { MessageBox.Show("Invalid Amount"); editor.EditValue = dAmt; } cRateQualR RAQual = new cRateQualR(); Collection QualVBC = new Collection(); //dtQualifier.Columns.Add("FlatId", typeof(int)); //dtQualifier.Columns.Add("PaymentSchId", typeof(int)); int iReceiptId = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "ReceiptTypeId")); int iOthId = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "OtherCostId")); DataView dv = new DataView(m_tQdT); dv.RowFilter = "FlatId = " + m_iFlatId + " and PaymentSchId = " + m_iPayShId + " and ReceiptTypeId = " + iReceiptId + " and OtherCostId = " + iOthId; dtQ = dv.ToTable(); if (dtQ.Rows.Count > 0) { dtTQ = dtQ.GetChanges().Copy(); } else { dtTQ = dtQ.Clone(); } for (int k = 0; k < dtQ.Rows.Count; k++) { DataTable dtTDS = new DataTable(); DataTable dtQ1 = new DataTable(); bService = Convert.ToBoolean(dtQ.Rows[k]["Service"]); iQualId = Convert.ToInt32(dtQ.Rows[k]["QualifierId"]); RAQual = new cRateQualR(); if (Convert.ToInt32(dtQ.Rows[k]["QualTypeId"]) == 2) { if (bService == true) { dtTDS = ReceiptDetailBL.GetSTSettings("G", m_dDate); } else { dtTDS = ReceiptDetailBL.GetSTSettings("F", m_dDate); } } else { dtTDS = ReceiptDetailBL.GetQual(iQualId, m_dDate); } dtQ1 = ReceiptDetailBL.QualifierSelect(iQualId, "B", m_dDate); if (dtTDS.Rows.Count > 0) { RAQual.RateID = iQualId; RAQual.ExpPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["ExpPer"], CommFun.datatypes.vartypenumeric)); RAQual.NetPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["Net"], CommFun.datatypes.vartypenumeric)); RAQual.SurPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["SurCharge"], CommFun.datatypes.vartypenumeric)); RAQual.EDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["EDCess"], CommFun.datatypes.vartypenumeric)); RAQual.HEDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["HEDCess"], CommFun.datatypes.vartypenumeric)); RAQual.HEDValue = 0; RAQual.TaxablePer = Convert.ToDecimal(CommFun.IsNullCheck(dtTDS.Rows[0]["Taxable"], CommFun.datatypes.vartypenumeric)); } if (dtQ1.Rows.Count > 0) { RAQual.Add_Less_Flag = dtQ1.Rows[0]["Add_Less_Flag"].ToString(); RAQual.Amount = 0; RAQual.Expression = dtQ1.Rows[0]["Expression"].ToString(); } //if (dtQ.Rows.Count > 0) //{ // RAQual.Add_Less_Flag = dtQ.Rows[0]["Add_Less_Flag"].ToString(); // RAQual.Amount = 0; // RAQual.Expression = dtQ.Rows[0]["Expression"].ToString(); // RAQual.RateID = Convert.ToInt32(dtQ.Rows[0]["QualifierId"].ToString()); // RAQual.ExpPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["ExpPer"], CommFun.datatypes.vartypenumeric)); // RAQual.NetPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["NetPer"], CommFun.datatypes.vartypenumeric)); // RAQual.SurPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["SurCharge"], CommFun.datatypes.vartypenumeric)); // RAQual.EDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["EDCess"], CommFun.datatypes.vartypenumeric)); // RAQual.HEDPer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["HEDPer"], CommFun.datatypes.vartypenumeric)); // RAQual.HEDValue = 0; // RAQual.TaxablePer = Convert.ToDecimal(CommFun.IsNullCheck(dtQ.Rows[0]["TaxablePer"], CommFun.datatypes.vartypenumeric)); //} QualVBC.Add(RAQual, RAQual.RateID.ToString(), null, null); } Qualifier.frmQualifier qul = new Qualifier.frmQualifier(); decimal dQNetAmt = 0; decimal dTaxAmt = 0; decimal dQBaseAmt = Convert.ToDecimal(CommFun.IsNullCheck(editor.EditValue, CommFun.datatypes.vartypenumeric)); DataRow dr1; decimal dTax = 0; decimal dVATAmt = 0; if (qul.Execute("B", ref dQBaseAmt, ref QualVBC, ref dQNetAmt, false, "", true, ref dTaxAmt, m_dDate, ref dVATAmt) == true) { int i = 0; DataRow dr; while (i < m_tQdT.Rows.Count) { dr = m_tQdT.Rows[i]; if (Convert.ToInt32(dr["FlatId"]) == m_iFlatId && Convert.ToInt32(dr["PaymentSchId"]) == m_iPayShId && Convert.ToInt32(dr["ReceiptTypeId"]) == iReceiptId && Convert.ToInt32(dr["OtherCostId"]) == iOthId) { m_tQdT.Rows.Remove(dr); } else { i++; } } foreach (Qualifier.cRateQualR d in QualVBC) { dr1 = m_tQdT.NewRow(); dr1["FlatId"] = m_iFlatId; dr1["PaymentSchId"] = m_iPayShId; dr1["QualifierId"] = d.RateID; DataView dv1 = new DataView(dtTQ); dv1.RowFilter = "QualifierId=" + d.RateID + ""; dr1["QualTypeId"] = dv1.ToTable().Rows[0]["QualTypeId"]; dr1["Service"] = dv1.ToTable().Rows[0]["Service"]; dr1["Expression"] = d.Expression; dr1["ExpPer"] = d.ExpPer; dr1["NetPer"] = d.NetPer; dTax = d.NetPer; dr1["Add_Less_Flag"] = d.Add_Less_Flag; dr1["SurCharge"] = d.SurPer; dr1["EDCess"] = d.EDPer; dr1["HEDPer"] = d.HEDPer; dr1["ExpValue"] = d.ExpValue; dr1["ExpPerValue"] = d.ExpPerValue; dr1["SurValue"] = d.SurValue; dr1["EDValue"] = d.EDValue; dr1["Amount"] = d.Amount; dr1["ReceiptTypeId"] = iReceiptId; dr1["OtherCostId"] = iOthId; dr1["TaxablePer"] = d.TaxablePer; dr1["TaxableValue"] = d.TaxableValue; m_tQdT.Rows.Add(dr1); } } grdViewReceipt.SetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidTaxAmount", dTaxAmt); grdViewReceipt.SetRowCellValue(grdViewReceipt.FocusedRowHandle, "PaidNetAmount", dQNetAmt); }