private void FrmReceipt_Load(object sender, EventArgs e) { cs.FrmStyle(this); DataSet ds; ds = db.GetTableData("Select pay_mode_id, pay_mode || '(' || pay_mode_id || ')' pay_mode, action_type from MAS_PAY_MODE"); CmbPayMode.DataSource = ds.Tables[0]; CmbPayMode.DisplayMember = "pay_mode"; CmbPayMode.ValueMember = "pay_mode_id"; ds = db.GetTableData("select region_id, region_name || '(' || region_id || ')' region_name, action_type from mas_region"); CmbRegion.DataSource = ds.Tables[0]; CmbRegion.DisplayMember = "region_Name"; CmbRegion.ValueMember = "region_id"; ds = db.GetTableData("select pay_mode_id, pay_mode || '('|| pay_mode_id || ')' Pay_mode, action_type from mas_pay_mode"); CmbPayMode.DataSource = ds.Tables[0]; CmbPayMode.DisplayMember = "pay_mode"; CmbPayMode.ValueMember = "pay_mode_id"; ds = db.GetTableData("Select bank_id, bank_name || '(' || bank_id ||')' Bank_name, action_type from mas_bank"); CmbBank.DataSource = ds.Tables[0]; CmbBank.DisplayMember = "Bank_Name"; CmbBank.ValueMember = "bank_id"; ds = db.GetTableData("select party_type_id, party_type_name || '(' || party_type_id || ')' party_type_name, action_type from MAS_PARTY_TYPE"); CmbPartyType.DataSource = ds.Tables[0]; CmbPartyType.DisplayMember = "party_type_name"; CmbPartyType.ValueMember = "party_type_id"; TxtRcptCode.Text = db.GetAccCode("RC", "mas_acc_receipt", "Receipt_code", DtpRcptDt.Value); }
private void Btn_Generate_Click(object sender, EventArgs e) { if (LVInvoices.CheckedItems.Count <= 0) { MessageBox.Show("Please select the items for generating Invoices", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBox.Show("Are you sure, Do you want to Generate Invoice(s)..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < LVInvoices.Items.Count; i++) { if (LVInvoices.Items[i].Checked == true) { string invcode = db.GetAccCode("IN", "hdr_acc_BS_invoice", "Invoice_Code", DtpInvDt.Value); string[] res = db.ExecuteQueries("Insert into mas_acc_bs_invoice values ('" + invcode + "','" + DtpInvDt.Value.ToString("dd-MMM-yy") + "','" + db.GetFinYr(DtpInvDt.Value) + "',1,0," + LVInvoices.Items[i].SubItems[1].Text.ToString() + ",'01-" + LVInvoices.Items[i].Text.ToString() + "','01-" + LVInvoices.Items[i].Text.ToString() + "'," + LVInvoices.Items[i].SubItems[11].Text.ToString() + ",null,null,null,null,null,null," + GlobalClass.UserName + "',sysdate,null,null,'I')").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } res = db.ExecuteQueries("Update mas_capsulling set invoice_code='" + invcode + "' where ro_header_code='" + LVInvoices.Items[i].Text.ToString() + "' and tx_month between '01-" + DtpMnthFrm.Value.ToString("MMM-yy") + "' and '01-" + DtpMnthTo.Value.ToString("MMM-yy") + "'").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Updation Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } MessageBox.Show("Successfully Generated", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadInvoices(); } }
private void Btn_Generate_Click(object sender, EventArgs e) { if (LVInvoices.CheckedItems.Count <= 0) { MessageBox.Show("No RO(s) selected for generating Invoices", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBox.Show("Are you sure, Do you want to Generate Invoice(s)..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < LVInvoices.Items.Count; i++) { if (LVInvoices.Items[i].Checked == true) { string invcode = db.GetAccCode("IN", "Mas_acc_invoice", "Invoice_Code", DtpInvDt.Value); string[] res = db.ExecuteQueries("Insert into mas_acc_invoice values ('" + invcode + "','" + DtpInvDt.Value.ToString("dd-MMM-yy") + "','" + db.GetFinYr(DtpInvDt.Value) + "'," + LVInvoices.Items[i].SubItems[12].Text.ToString() + "," + LVInvoices.Items[i].SubItems[13].Text.ToString() + "," + LVInvoices.Items[i].SubItems[11].Text.ToString() + ",'01-" + DtpMnthFrm.Value.ToString("MMM-yy") + "','01-" + DtpMnthTo.Value.ToString("MMM-yy") + "','" + LVInvoices.Items[i].Text.ToString() + "'," + LVInvoices.Items[i].SubItems[4].Text.ToString() + "," + LVInvoices.Items[i].SubItems[5].Text.ToString() + ",null," + LVInvoices.Items[i].SubItems[6].Text.ToString() + ",null," + LVInvoices.Items[i].SubItems[7].Text.ToString() + ",null," + LVInvoices.Items[i].SubItems[8].Text.ToString() + ",null," + LVInvoices.Items[i].SubItems[9].Text.ToString() + "," + LVInvoices.Items[i].SubItems[10].Text.ToString() + ",'" + DtpInvDt.Value.ToString("dd-MMM-yy") + "', null,null,null,null,'" + GlobalClass.UserName + "',sysdate,null,null,'I')").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } res = db.ExecuteQueries("Update mas_capsulling set invoice_code='" + invcode + "' where invoice_code is null and ro_header_code='" + LVInvoices.Items[i].Text.ToString() + "' and tx_month between '01-" + DtpMnthFrm.Value.ToString("MMM-yy") + "' and '01-" + DtpMnthTo.Value.ToString("MMM-yy") + "'").Split(','); if (res[0].ToString() != "0") { MessageBox.Show("Updation Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } db.ExecuteQueries("update mas_acc_invoice mai set billing_frm=(select min(tx_month) from mas_capsulling where invoice_code=mai.invoice_code), billing_to=(select max(tx_month) from mas_capsulling where invoice_code=mai.invoice_code) where invoice_date = '" + DtpInvDt.Value.ToString("dd-MMM-yyyy") + "'"); db.ExecuteQueries("insert into c##tekdev.mas_acc_reconcillation (SELECT(SELECT MAX(RECON_CODE) FROM C##TEKDEV.MAS_ACC_RECONCILLATION)+ROWNUM RECON_CODE, INVOICE_DATE RECON_DATE, FNYR, 0 GROUP_CODE, mai.AGENCY_CODE,mai.CLIENT_CODE, hr.REGION_CODE, invoice_code REFERENCE_CODE, invoice_date REFERENCE_DATE, 'D' TRANS_TYPE, 'I' TRANS_SUB_TYPE, null BANK_NAME, null CHEQUE_NO, null CHQ_TRX_DATE, null CREDIT_AMOUNT, amount DEBIT_AMOUNT, mai.REMARKS, 6 CHANNEL_CODE, mai.CREATED_BY, mai.CREATED_DATE, mai.modified_by, mai.modified_date, mai.ACTION_TYPE FROM MAS_ACC_INVOICE Mai, hdr_ro hr where hr.ro_header_code(+) = mai.ro_header_code and invoice_code > (SELECT MAX(INVOICE_CODE) FROM C##TEKDEV.MAS_ACC_INVOICE WHERE CHANNEL_CODE=6))"); db.ExecuteQueries("INSERT INTO C##TEKDEV.MAS_ACC_INVOICE (select Invoice_code, invoice_date, fnyr, 0 group_code, agency_code, client_code, billing_frm, billing_to, null tx_code, null tx_date, ro_header_code, null ro_detail_code, null actual_telecast_time, gross_amount, null service_tax, null swatch_cess_tax, null kk_cess_tax, null ec_tax, null hec_tax, sgst_tax_amt sgst_tax, cgst_tax_amt cgst_tax, igst_tax_amt igst_tax, discount, misc_amount, amount, receipt_amt receipt_amount, due_date, cn_amount, dn_amount, null duration, null sector4, null invoice_status, null last_posted_date, remarks, 6 channel_code, created_by, created_date, modified_by, modified_date, action_type from mas_acc_invoice where invoice_code > (SELECT MAX(INVOICE_CODE) FROM C##TEKDEV.MAS_ACC_INVOICE WHERE CHANNEL_CODE=6))"); db.ExecuteQueries("INSERT INTO C##TEKDEV.HDR_RO (SELECT RO_HEADER_CODE, RO_DATE, 0 GROUP_CODE, AGENCY_CODE, CLIENT_CODE, SALES_PERSON_CODE, REGION_CODE, 0 CITY_CODE, NULL DEAL_CODE, NULL PROPOSAL_CODE, NULL TYPE_OF_RO, AD_CATEGORY_CODE, NULL RATE_CARD_CATEGORY, NULL GOVT_GEN_FLAG, CLIENT_REFERENCE_CODE, CLIENT_REFERENCE_DATE, BILLING_MODE, 'N' AUDIT_STATUS, 0 EVENT_ID, IS_INCLUDE_TAX, IS_COMBO, REMARKS, 6 CHANNEL_CODE, CREATED_BY, CREATED_DATE, MODIFIED_BY, MODIFIED_DATE, ACTION_TYPE FROM HDR_RO WHERE RO_HEADER_CODE NOT IN(SELECT RO_HEADER_CODE FROM C##TEKDEV.HDR_RO WHERE CHANNEL_CODE=6))"); MessageBox.Show("Successfully Generated", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadInvoices(); } }