private void CmbPType_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds = null; if (Convert.ToInt32(db.ExtractCode(CmbPType.Text)) == 1) { ds = db.GetTableData("select executive_id Party_id, executive_name || '('|| executive_id ||')' Party_name, action_type from mas_executive"); } else if (Convert.ToInt32(db.ExtractCode(CmbPType.Text)) == 2) { ds = db.GetTableData("select distributor_code Party_id, distributor_name || '(' || distributor_code ||')' party_name, action_type from mas_distributor"); } if (ds != null) { CmbParty.DataSource = ds.Tables[0]; CmbParty.DisplayMember = "party_name"; CmbParty.ValueMember = "party_id"; } else { CmbParty.DataSource = null; CmbParty.Items.Clear(); } }
private void button1_Click(object sender, EventArgs e) { DataSet ds; if (Convert.ToInt16(db.ExtractCode(CmbADCategory.Text)) > 0) { ds = db.GetTableData("select dr.ro_detail_code, dr.ro_header_code, publish_month, brand, caption,rate_card_amount, published_page page_no, mc.Remarks, dr.action_type from dtl_ro dr, hdr_ro hr,mas_capsulling mc where hr.ro_header_code (+)= dr.ro_header_code and mc.ro_header_code (+)= dr.ro_header_code and mc.ro_detail_code (+)= dr.ro_detail_code and ro_status='B' and publish_month='01-" + DtpMnth.Value.ToString("MMM-yy") + "' and ad_category_code=" + db.ExtractCode(CmbADCategory.Text) + " order by ro_detail_code"); } else { ds = db.GetTableData("select dr.ro_detail_code, dr.ro_header_code, publish_month, brand, caption,rate_card_amount, published_page page_no, mc.Remarks, dr.action_type from dtl_ro dr, hdr_ro hr,mas_capsulling mc where hr.ro_header_code (+)= dr.ro_header_code and mc.ro_header_code (+)= dr.ro_header_code and mc.ro_detail_code (+)= dr.ro_detail_code and ro_status='B' and publish_month='01-" + DtpMnth.Value.ToString("MMM-yy") + "' order by ro_detail_code"); } dataGridView1.ReadOnly = false; dataGridView1.DataSource = ds.Tables[0]; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].HeaderText = "RO Header Code"; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].Visible = false; dataGridView1.Columns[3].HeaderText = "Brand"; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].HeaderText = "Caption"; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].HeaderText = "Amount"; dataGridView1.Columns[5].ReadOnly = true; dataGridView1.Columns[6].HeaderText = "Page No"; dataGridView1.Columns[6].ReadOnly = false; dataGridView1.Columns[7].HeaderText = "Reamrks"; dataGridView1.Columns[7].ReadOnly = false; dataGridView1.Columns[8].Visible = false; }
private string vouchernumber() { string res = "1"; DataSet ds = db.GetTableData("Select max(voucher_no) vno, decode(spd.action_type,'U','I',spd.Action_type) Action_type from mas_sub_pay_details spd, mas_subscriptions ms where ms.sub_id (+)= spd.sub_id and state_id=" + db.ExtractCode(CmbState.Text) + " and district_id=" + db.ExtractCode(CmbDistrict.Text) + " group by decode(spd.action_type,'U','I',spd.Action_type)"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { try { int tt = Convert.ToInt32(dr["vno"].ToString()); tt++; res = tt.ToString(); } catch { } } } return(res); }
private void CmbRegion_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds = null; if (db.ExtractCode(CmbPartyType.Text) == "1") { ds = db.GetTableData("select executive_id Party_Code, executive_name || '(' || executive_id || ')' Party_name, action_type from mas_executive"); } else if (db.ExtractCode(CmbPartyType.Text) == "2") { ds = db.GetTableData("select distributor_code Party_Code, distributor_name || '(' || distributor_code || ')' Party_name, action_type from mas_distributor where region_id=" + db.ExtractCode(CmbRegion.Text)); } if (ds != null) { CmbParty.DataSource = ds.Tables[0]; CmbParty.DisplayMember = "Party_name"; CmbParty.ValueMember = "Party_Code"; } }
private void CmbRegion_SelectedIndexChanged(object sender, EventArgs e) { string ptype = ""; if (CmbPartyType.Text == "Agency") { ptype = "AG"; } else { ptype = "CL"; } DataSet ds = db.GetTableData("Select * from mas_address_book where region_id=" + db.ExtractCode(CmbRegion.Text) + " and Party_type='" + ptype + "' and party_code=" + db.ExtractCode(CmbPartyName.Text)); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { LblPK.Text = dr["address_id"].ToString(); TxtAddress.Text = dr["Address"].ToString(); TxtCity.Text = dr["Town_City"].ToString(); TxtPIN.Text = dr["pincode"].ToString(); TxtTelPh.Text = dr["Telephone"].ToString(); TxtFax.Text = dr["Fax"].ToString(); TxtMobile.Text = dr["Mobile"].ToString(); TxtMail.Text = dr["email_id"].ToString(); TxtStateCode.Text = dr["State_Code"].ToString(); TxtGSTNo.Text = dr["GST_No"].ToString(); TxtPANNo.Text = dr["PAN_NO"].ToString(); TxtRemarks.Text = dr["Remarks"].ToString(); } } else { LblPK.Text = ""; TxtAddress.Text = ""; TxtCity.Text = ""; TxtPIN.Text = ""; TxtTelPh.Text = ""; TxtFax.Text = ""; TxtMobile.Text = ""; TxtMail.Text = ""; TxtGSTNo.Text = ""; TxtStateCode.Text = ""; TxtPANNo.Text = ""; TxtRemarks.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { if (TxtName.Text.Trim().Length <= 0) { MessageBox.Show("Invalid Distributor Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (TxtAddress.Text.Trim().Length <= 0) { MessageBox.Show("Invalid Distributor Address", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataSet ds; if (LblPK.Text.Trim().Length > 0) { ds = db.GetTableData("select * from mas_distributor where distributor_name='" + TxtName.Text.Trim() + "' and region_id=" + db.ExtractCode(CmbRegion.Text) + " and distributor_code<>" + LblPK.Text); } else { ds = db.GetTableData("select * from mas_distributor where distributor_name='" + TxtName.Text.Trim() + "' AND region_ID=" + db.ExtractCode(CmbRegion.Text)); } if (ds.Tables[0].Rows.Count > 0) { MessageBox.Show("This Distributor Name already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string[] res; if (LblPK.Text.Trim().Length > 0) { res = db.ExecuteQueries("Update mas_distributor set distributor_name='" + TxtName.Text.Trim() + "', region_id=" + db.ExtractCode(CmbRegion.Text) + ", distributor_address='" + TxtAddress.Text.Trim() + "', remarks='" + TxtRemarks.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', MODIFIED_DATE=SYSDATE WHERE DISTRIBUTOR_CODE=" + LblPK.Text.Trim()).Split(','); } else { res = db.ExecuteQueries("INSERT INTO MAS_DISTRIBUTOR VALUES (" + db.GetNewID("mas_distributor", "distributor_code") + ",'" + TxtName.Text.Trim() + "'," + db.ExtractCode(CmbRegion.Text) + ",'" + TxtAddress.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(','); } if (res[0].ToString() != "0") { MessageBox.Show("Updation Failure..", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtAddress.Text = ""; TxtName.Text = ""; TxtRemarks.Text = ""; LblPK.Text = ""; TxtName.Focus(); } }
private void button1_Click(object sender, EventArgs e) { string IsCombo = "N"; if (TxtBrand.Text.Trim().Length <= 0) { MessageBox.Show("Invalid Brand Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (TxtCaption.Text.Trim().Length <= 0) { MessageBox.Show("Invalid Caption Details", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (TxtCaption.Text.Trim().Length <= 0) { MessageBox.Show("Invalid AD Size", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToInt32(TxtNoofAds.Text) <= 0) { MessageBox.Show("Please Enter No. of Ads", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBox1.Checked) { if (TxtActualRate.Text.Trim().Length <= 0) { MessageBox.Show("Please enter Actual Rate", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToDouble(TxtActualRate.Text) <= 0) { MessageBox.Show("Invalid Actual Rate", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IsCombo = "Y"; } string[] res; if (IsNewRo) { TxtROCode.Text = GetROCode(); res = db.ExecuteQueries("Insert into hdr_ro values ('" + TxtROCode.Text.Trim() + "','" + DtpRoDt.Value.ToString("dd-MMM-yy") + "'," + db.ExtractCode(CmbAgency.Text) + "," + db.ExtractCode(CmbClient.Text) + "," + db.ExtractCode(CmbExecutive.Text) + "," + db.ExtractCode(CmbRegion.Text) + "," + db.ExtractCode(CmbADCategory.Text) + ",null,'" + TxtClientRefNo.Text.Trim() + "','" + DtpRefDt.Value.ToString("dd-MMM-yy") + "','" + CmbBillingMode.Text.Trim() + "',null,'" + IsCombo + "',null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Insertion Failure in RO Header", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DateTime dtfrm = Convert.ToDateTime("01-" + DtpMnthFrm.Value.ToString("MMM-yy")); DateTime dtto = Convert.ToDateTime("01-" + DtpMnthTo.Value.ToString("MMM-yy")); DataSet ds = db.GetTableData("select max(sr_no) srno, decode(action_type,'U','I','D','I',action_type) Action_type from dtl_ro where ro_header_code='" + TxtROCode.Text.ToString() + "' group by decode(action_type,'U','I','D','I',action_type)"); int i = 0; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { i = Convert.ToInt32(dr["srno"].ToString()); } } for (DateTime dt = dtfrm; dt <= dtto; dt = dt.AddMonths(1)) { for (int r = 1; r <= Convert.ToInt32(TxtNoofAds.Text); r++) { i++; res = db.ExecuteQueries("Insert into dtl_ro values (" + db.GetNewID("dtl_ro", "ro_detail_code") + "," + db.ExtractCode(CmbSpotCategory.Text) + ",'" + dt.ToString("dd-MMM-yy") + "'," + TxtNoofAds.Text.Trim() + "," + TxtReateCard.Text.Trim() + "," + TxtActualRate.Text.Trim() + ",'" + TxtBrand.Text.Trim() + "','" + TxtCaption.Text.Trim() + "','" + TxtSize.Text.Trim() + "','B','" + TxtROCode.Text.Trim() + "'," + i.ToString() + ",null,null,null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Insertioin Failure in RO Detail Code", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); db.ExecuteQueries("Delete from hdr_ro where ro_header_code='" + TxtROCode.Text + "'"); db.ExecuteQueries("Delete from dtl_ro where ro_header_code='" + TxtROCode.Text + "'"); TxtROCode.Text = GetROCode(); return; } } } if (MessageBox.Show("Successfully Saved. Do you want to Continuee with same RO..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { groupBox1.Enabled = false; IsNewRo = false; TxtReateCard.Text = ""; TxtActualRate.Text = ""; TxtBrand.Text = ""; TxtCaption.Text = ""; TxtSize.Text = ""; TxtNoofAds.Text = ""; DataSet ds1 = db.GetTableData("select * from dtl_ro where ro_header_code='" + TxtROCode.Text.Trim() + "' order by sr_no"); dataGridView1.DataSource = ds1.Tables[0]; } else { TxtROCode.Text = GetROCode(); IsNewRo = true; groupBox1.Enabled = true; TxtReateCard.Text = ""; TxtActualRate.Text = ""; TxtBrand.Text = ""; TxtCaption.Text = ""; TxtSize.Text = ""; TxtNoofAds.Text = ""; dataGridView1.DataSource = null; dataGridView1.Rows.Clear(); } }
private void button1_Click(object sender, EventArgs e) { DataSet ds; if (TxtName.Text.Trim().Length <= 0) { MessageBox.Show("Enter Client Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToInt32(db.ExtractCode(CmbState.Text)) <= 0) { MessageBox.Show("Invalid State Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (LblPK.Text.Trim().Length > 0) { ds = db.GetTableData("Select * from mas_client where client_name='" + TxtName.Text.Trim() + "' and client_code<>" + LblPK.Text); } else { ds = db.GetTableData("Select * from mas_client where client_name='" + TxtName.Text.Trim() + "'"); } if (ds.Tables[0].Rows.Count > 0) { MessageBox.Show("This Client Name already Exists", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string[] res; string act = "N"; if (ChkActive.Checked) { act = "Y"; } if (LblPK.Text.Trim().Length > 0) { res = db.ExecuteQueries("Update mas_client set client_name='" + TxtName.Text.Trim() + "', client_Commission=" + TxtComm.Text.Trim() + ", active_flag='" + act + "',State_code='" + db.ExtractCode(CmbState.Text) + "',gst_no='" + TxtGSTNo.Text.Trim() + "', pan_no='" + TxtPANNo.Text.Trim() + "', Remarks='" + TxtRemarks.Text.Trim() + "', Modified_by='" + GlobalClass.UserName + "', Modified_date=sysdate where client_code=" + LblPK.Text).Split(','); } else { res = db.ExecuteQueries("Insert into mas_client values (" + db.GetNewID("mas_client", "client_Code") + ",'" + TxtName.Text.Trim() + "'," + TxtComm.Text.Trim() + ",null,'" + act + "','" + db.ExtractCode(CmbState.Text) + "','" + TxtGSTNo.Text.Trim() + "','" + TxtPANNo.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(','); } if (res[0].ToString() != "0") { MessageBox.Show("Updation Failure", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtCode.Text = db.GetNewID("Mas_Client", "Client_Code").ToString(); TxtName.Text = ""; TxtGSTNo.Text = ""; TxtPANNo.Text = ""; TxtRemarks.Text = ""; ChkActive.Checked = false; LblPK.Text = ""; } }