private void btnSave_Click(object sender, EventArgs e) { if (txtID.Text.Trim() == "") { MessageBox.Show("Please Enter Code.", "FINNSOFT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtID.Focus(); return; } if (txtDesc.Text.Trim() == "") { MessageBox.Show("Please Enter Name.", "FINNSOFT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtDesc.Focus(); return; } string result = ""; clsSLBAL SlBAL = new clsSLBAL(); string SlType = ""; Double Opening = 0; if (radioButton2.Checked == true) { Opening = 0 - Convert.ToDouble(txtOpen.Text); } else { Opening = Math.Abs(Convert.ToDouble(txtOpen.Text)); } if (Convert.ToString(listGL.SelectedValue) == "00004" || Convert.ToString(listGL.SelectedValue) == "00003") { SlType = cmbType.Text.Substring(0, 1); } else { SlType = "G"; } if (btnSave.Text == "&Save") { result = SlBAL.SaveData(Global.finyr, Global.branch, Convert.ToString(listGL.SelectedValue), txtID.Text.Trim(), txtDesc.Text.Trim(), txtAdd1.Text, txtAdd2.Text, txtCity.Text, txtPin.Text, txtFax.Text, txtPhone.Text, txtContact.Text, txtRem.Text, Opening, SlType, textBox1.Text); } else { result = SlBAL.UpdateData(Global.finyr, Global.branch, Convert.ToString(listGL.SelectedValue), txtID.Text.Trim(), txtDesc.Text.Trim(), txtAdd1.Text, txtAdd2.Text, txtCity.Text, txtPin.Text, txtFax.Text, txtPhone.Text, txtContact.Text, txtRem.Text, Opening, SlType, textBox1.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(); listGL_Click(null, null); }
private void listSub_Click(object sender, EventArgs e) { clsSLBAL SlBAL = new clsSLBAL(); clsSLBO SlBO = new clsSLBO(); //string crt = "GLID"; SlBO = SlBAL.GetValue(Convert.ToString(listSub.SelectedValue)); txtID.Text = SlBO.GetSLID(); txtDesc.Text = SlBO.GetSL_L_NAME(); txtAdd1.Text = SlBO.GetSLADD1(); txtAdd2.Text = SlBO.GetSLADD2(); txtCity.Text = SlBO.GetSLCITY(); txtPin.Text = SlBO.GetSLPIN(); txtPhone.Text = SlBO.GetSLPHONE(); txtFax.Text = SlBO.GetSLFAX(); txtContact.Text = SlBO.GetSLCONT_PERS(); txtRem.Text = SlBO.GetREMARKS(); txtOpen.Text = Convert.ToString(Math.Abs(SlBO.Getop_bal())); textBox1.Text = SlBO.Getgstin(); if (SlBO.Getop_bal() >= 0) { radioButton1.Checked = true; //cmbOpenType.Text = "Dr"; } else { radioButton2.Checked = true; //cmbOpenType.Text = "Cr"; } if (Convert.ToString(SlBO.GetGLID()) == "00004" || Convert.ToString(SlBO.GetGLID()) == "00003") { if (Convert.ToString(SlBO.GetSTATUS()) == "G") { cmbType.Text = "General"; } else if (Convert.ToString(SlBO.GetSTATUS()) == "C") { cmbType.Text = "Customer"; } else if (Convert.ToString(SlBO.GetSTATUS()) == "S") { cmbType.Text = "Supplier"; } } if (SlBO.GetSL_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"]); } }