private void btnSave_Click(object sender, EventArgs e) { if (txtCode.Text.Trim() == "") { MessageBox.Show("Please Enter Code.", "FINNSOFT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCode.Focus(); return; } if (txtName.Text.Trim() == "") { MessageBox.Show("Please Enter Name.", "FINNSOFT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtName.Focus(); return; } string result = ""; clsGLBAL GlBAL = new clsGLBAL(); Int32 subL = 0; Double Opening = 0; if (cmbSubL.Text == "Yes") { subL = 1; } else { subL = 0; } if (cmbOpenType.Text == "Cr") { Opening = 0 - Convert.ToDouble(txtOpen.Text); } else { Opening = Math.Abs(Convert.ToDouble(txtOpen.Text)); } if (btnSave.Text == "&Save") { result = GlBAL.SaveData(Global.finyr, Global.branch, txtCode.Text.Trim(), txtName.Text.Trim(), Convert.ToInt32(cmbType.SelectedValue), subL, Opening, txtNarration.Text); } else { result = GlBAL.UpdateData(Global.finyr, Global.branch, txtCode.Text.Trim(), txtName.Text.Trim(), Convert.ToInt32(cmbType.SelectedValue), subL, Opening, txtNarration.Text); } // //txtCode.AutoCompleteCustomSource.Add(txtCode.Text); //txtName.AutoCompleteCustomSource.Add(txtName.Text); //clsVar.autoPatCode.Add(txtCode.Text); //clsVar.autoPatName.Add(txtName.Text); // MessageBox.Show(result, "FINNSOFT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); newform(); fillGL(); }
private void listGL_Click(object sender, EventArgs e) { clsGLBAL GlBAL = new clsGLBAL(); DataTable dt; clsGLBO GlBO = new clsGLBO(); string crt = "GLID"; GlBO = GlBAL.GetValue(Convert.ToString(listGL.SelectedValue)); txtCode.Text = GlBO.GetGLID(); cmbType.SelectedValue = GlBO.GetPL_BS_ID(); txtName.Text = GlBO.GetGL_L_NAME(); txtNarration.Text = GlBO.GetNarration(); if (GlBO.GetANYSL() == 0) { cmbSubL.Text = "No"; } else { cmbSubL.Text = "Yes"; } txtOpen.Text = Convert.ToString(Math.Abs(GlBO.Getop_bal())); if (GlBO.Getop_bal() > 1) { cmbOpenType.Text = "Dr"; } else { cmbOpenType.Text = "Cr"; } if (GlBO.GetGL_L_NAME() != "") { btnSave.Text = "&Update"; } else { btnSave.Text = "&Save"; } }
private void FillData() { clsGLBAL GlBAL = new clsGLBAL(); clsGLBO GlBO = new clsGLBO(); clsSLBAL SlBAL = new clsSLBAL(); clsSLBO SlBO = new clsSLBO(); dataGridView1.Columns["Debit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["Credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Font = new Font(dataGridView1.Font, FontStyle.Bold); dataGridView1.Columns["Date"].DefaultCellStyle.Font = style.Font; dataGridView1.Columns["Type"].DefaultCellStyle.Font = style.Font; dataGridView1.Columns["VNO"].DefaultCellStyle.Font = style.Font; //Date //Type //VNo //Particular //Debit //Credit //Glid //Slid //TrnType //V_No string QRY = ""; if (listBox1.SelectedIndex != 0) { QRY = "Select * from LedgerView where BrCode='" + Global.branch + "' and TranType='" + vtype_list1 + "' and VDT>='" + dtpFrom.Value.ToString("dd/MM/yyyy") + "' and VDT<'" + dtpTo.Value.AddDays(1).ToString("dd/MM/yyyy") + "' order by VDT, TranType, Vno"; } else { QRY = "Select * from LedgerView where BrCode='" + Global.branch + "'and VDT>='" + dtpFrom.Value.ToString("dd/MM/yyyy") + "' and VDT<'" + dtpTo.Value.AddDays(1).ToString("dd/MM/yyyy") + "' order by VDT, TranType, Vno"; } SqlDataAdapter da = new SqlDataAdapter(QRY, clsConnection.Conn); DataSet ds = new DataSet(); if (ds.Tables["DayBook"] != null) { ds.Tables["DayBook"].Clear(); } da.Fill(ds, "DayBook"); DataTable dt = ds.Tables["DayBook"]; string lastvno = ""; string lastvdt = ""; string lastvtype = ""; Int32 i = 0; foreach (DataRow row in dt.Rows) { dataGridView1.Rows.Add(); if (lastvno == Convert.ToString(row["VNO"]) && lastvdt == Convert.ToString(row["VDT"]) && lastvtype == Convert.ToString(row["TRANTYPE"])) { i = i + 1; } else { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Date"].Value = Convert.ToDateTime(row["VDT"]).ToString("dd/MM/yyyy"); if (Convert.ToString(row["TRANTYPE"]) == "Y") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Payment"; } else if (Convert.ToString(row["TRANTYPE"]) == "R") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Receipt"; } else if (Convert.ToString(row["TRANTYPE"]) == "J") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Journal"; } else if (Convert.ToString(row["TRANTYPE"]) == "T") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Contra"; } else if (Convert.ToString(row["TRANTYPE"]) == "P") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Purchase"; } else if (Convert.ToString(row["TRANTYPE"]) == "S") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Type"].Value = "Sale"; } dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["VNo"].Value = Convert.ToString(row["VNO"]); } if ((string.IsNullOrEmpty(row["SLID"].ToString()) ? "" : row["SLID"].ToString()) == "" || row["SLID"].ToString() == "0" || row["SLID"].ToString() == "00") { GlBO = GlBAL.GetValue(Convert.ToString(row["GLID"])); dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Particular"].Value = GlBO.GetGL_L_NAME(); } else { SlBO = SlBAL.GetValue(Convert.ToString(row["SLID"])); dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Particular"].Value = SlBO.GetSL_L_NAME(); //Convert.ToString(row["SL_L_NAME"]); } if (Convert.ToString(row["AMTTYPE"]) == "D") { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Debit"].Value = Math.Round(Convert.ToDouble(row["AMT"]), 2); } else { dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Credit"].Value = Math.Round(Convert.ToDouble(row["AMT"]), 2); } dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Glid"].Value = Convert.ToString(row["GLID"]); dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["Slid"].Value = (string.IsNullOrEmpty(row["SLID"].ToString()) ? "" : row["SLID"]); dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["TrnType"].Value = Convert.ToString(row["TRANTYPE"]); dataGridView1.Rows[dataGridView1.Rows.Count - 2].Cells["V_NO"].Value = Convert.ToString(row["VNO"]); lastvno = Convert.ToString(row["VNO"]); lastvdt = Convert.ToString(row["VDT"]); lastvtype = Convert.ToString(row["TRANTYPE"]); } }