コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtType.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Subscription Type", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TxtIssues.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid No. of Subscriptions", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DataSet ds;

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_sub_type where sub_type_id<>" + LblPK.Text.Trim() + " and sub_type_name='" + TxtType.Text.Trim() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("This Subscription Type already exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                ds = db.GetTableData("select * from mas_sub_type where sub_type_name='" + TxtType.Text.Trim() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("This Subscription Type already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_sub_type set sub_type_name='" + TxtType.Text.Trim() + "', issues=" + TxtIssues.Text.Trim() + ", Remarks='" + TxtRemarks.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_type_id=" + LblPK.Text.Trim()).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Insert into mas_sub_type values (" + db.GetNewID("mas_sub_type", "sub_type_id") + ",'" + TxtType.Text.Trim() + "'," + TxtIssues.Text.Trim() + ",'" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            }

            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion / Updation Failure..", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtIssues.Text  = "";
                TxtRemarks.Text = "";
                TxtType.Text    = "";
                LblPK.Text      = "";
                TxtType.Focus();
            }
        }
コード例 #2
0
ファイル: FrmSubBOS.cs プロジェクト: bandirajesh83/HDMagazine
        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();
            }
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you Sure, Do you want to Save..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    string[] res;
                    if (dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString().Trim().Length > 0 || dataGridView1.Rows[i].Cells["Remarks"].Value.ToString().Trim().Length > 0)
                    {
                        DataSet ds = db.GetTableData("Select * from mas_capsulling where ro_detail_code=" + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString());
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            res = db.ExecuteQueries("Update mas_capsulling set published_page='" + dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString() + "',Remarks='" + dataGridView1.Rows[i].Cells["Remarks"].Value.ToString() + "', Modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where ro_detail_code=" + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString()).Split(',');
                        }
                        else
                        {
                            res = db.ExecuteQueries("Insert into mas_capsulling values (" + db.GetNewID("Mas_Capsulling", "Tx_Code") + ",'01-" + DtpMnth.Value.ToString("MMM-yy") + "','" + dataGridView1.Rows[i].Cells["RO_Header_Code"].Value.ToString() + "'," + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString() + ",'" + dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString() + "',null,'" + dataGridView1.Rows[i].Cells["Remarks"].Value.ToString() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                        }

                        if (res[0].ToString() != "0")
                        {
                            MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
                MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataSet ds;

            if (TxtName.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid State Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtStateCode.Text.Trim().Length != 2)
            {
                MessageBox.Show("Invalid State Code", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtStateName.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid State Code", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_state where state_name='" + TxtName.Text.Trim() + "' and state_id<>" + LblPK.Text);
            }
            else
            {
                ds = db.GetTableData("select * from mas_state where state_name='" + TxtName.Text.Trim() + "'");
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("This State Name already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_state set state_name='" + TxtName.Text.Trim() + "', gst_state_code='" + TxtStateCode.Text.Trim() + "', remarks='" + TxtRemarks.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where state_id=" + LblPK.Text).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Insert into mas_state values (" + db.GetNewID("mas_state", "state_id") + ",'" + TxtName.Text.Trim() + "','" + TxtStateCode.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            }
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtID.Text        = db.GetNewID("mas_state", "state_id").ToString();
                TxtName.Text      = "";
                TxtStateCode.Text = "";
                TxtStateName.Text = "";
                TxtRemarks.Text   = "";
                LblPK.Text        = "";
            }
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtUserName.Text.Trim().Length < 4)
            {
                MessageBox.Show("Invalid User Name. User Name should be minimum 4 Characters", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUserName.Focus();
                return;
            }

            if (TxtPwd.Text.Trim().Length < 4)
            {
                MessageBox.Show("Invalid Password. Password should be minimum 4 characters", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPwd.Focus();
                return;
            }

            DataSet ds;

            if (LblPK.Text.Trim().Length <= 0)
            {
                ds = db.GetTableData("select * from mas_adm_user where user_name='" + TxtUserName.Text.Trim() + "'");
            }
            else
            {
                ds = db.GetTableData("select * from mas_adm_user where user_name='" + TxtUserName.Text.Trim() + "' and user_id<>" + LblPK.Text);
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("This User Name already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUserName.Focus();
                return;
            }

            string[] res;
            if (LblPK.Text.Trim().Length <= 0)
            {
                res = db.ExecuteQueries("Insert into mas_adm_user values (" + db.GetNewID("mas_adm_user", "user_id") + ",'" + TxtUserName.Text.Trim() + "','" + TxtPwd.Text.Trim() + "','" + CmbStatus.Text.Substring(0, 1) + "',null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Update mas_adm_user set user_name='" + TxtUserName.Text.Trim() + "', Pwd='" + TxtPwd.Text.Trim() + "', status='" + CmbStatus.Text.Substring(0, 1) + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where user_id=" + LblPK.Text.Trim()).Split(',');
            }

            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Failure...\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtPwd.Text      = "";
                TxtUserName.Text = "";
                TxtUserName.Focus();
                LblPK.Text = "";
            }
        }
コード例 #6
0
        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();
            }
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure, Do you want to Generate...?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                int     gensubs = 0;
                DataSet ds      = db.GetTableData("select * from mas_sub_pay_details where ('01-" + DtpMnth.Value.ToString("MMM-yy") + "' between period_frm and period_to) and sub_id not in (select sub_id from mas_sub_issues where issue_month='01-" + DtpMnth.Value.ToString("MMM-yy") + "')");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int     issue = 1;
                    DataSet ds1   = db.GetTableData("select action_type, max(current_sub_no) issue from mas_sub_issues where sub_id=" + dr["sub_id"].ToString() + " group by action_type");
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            issue = Convert.ToInt32(dr1["issue"].ToString()) + 1;
                        }
                    }
                    double   id  = db.GetNewID("mas_sub_issues", "issue_id");
                    string[] res = db.ExecuteQueries("Insert into mas_sub_issues values (" + id + "," + dr["sub_id"].ToString() + "," + dr["pay_id"].ToString() + ",'01-" + DtpMnth.Value.ToString("MMM-yy") + "','" + DtpDspchDt.Value.ToString("dd-MMM-yy") + "'," + issue + "," + dr["Quantity"].ToString() + ",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;
                    }
                    gensubs++;
                    TxtSub.Text = gensubs.ToString();
                    Application.DoEvents();
                }

                MessageBox.Show("Successfully Generated", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtOPwd.Text.Trim().Length <= 0 || TxtNPwd.Text.Trim().Length <= 0 || TxtCPwd.Text.Trim().Length <= 0)
            {
                MessageBox.Show("All fields are mandatory", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string  pwd = "";
            DataSet ds  = db.GetTableData("select * From mas_adm_user where user_name='" + TxtUserName.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    pwd = dr["pwd"].ToString();
                }
            }

            if (pwd != TxtOPwd.Text.Trim())
            {
                MessageBox.Show("Invalid Old Password", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtCPwd.Text.Trim() != TxtNPwd.Text.Trim())
            {
                MessageBox.Show("New Password and Confirm Password does not matched", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtNPwd.Text.Trim() == TxtOPwd.Text.Trim())
            {
                MessageBox.Show("Old Password and New Password is same", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string[] res = db.ExecuteQueries("Update mas_adm_user set pwd='" + TxtNPwd.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where user_name='" + TxtUserName.Text.Trim() + "'").Split(',');
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Updation Failure..", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtCPwd.Text = "";
                TxtNPwd.Text = "";
                TxtOPwd.Text = "";
                TxtOPwd.Focus();
            }
        }
コード例 #9
0
        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();
            }
        }
コード例 #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CmbRegion.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbRegion.Text)) <= 0)
            {
                MessageBox.Show("Invalid Region Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbRegion.Focus();
                return;
            }

            if (CmbParty.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbParty.Text)) <= 0)
            {
                MessageBox.Show("Invalid Party Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbParty.Focus();
                return;
            }

            if (CmbPayMode.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbPayMode.Text)) <= 0)
            {
                MessageBox.Show("Invalid Payment Mode", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbPayMode.Focus();
                return;
            }

            if (CmbBank.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbBank.Text)) <= 0)
            {
                MessageBox.Show("Invalid Bank Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbBank.Focus();
                return;
            }

            if (TxtAmount.Text.Length <= 0)
            {
                MessageBox.Show("Invalid Receipt Amount", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAmount.Focus();
                return;
            }

            if (Convert.ToDouble(TxtAmount.Text) <= 0)
            {
                MessageBox.Show("Invalid Receipt Amount", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAmount.Focus();
                return;
            }

            string rcptno = db.GetAccCode("RC", "mas_acc_receipt", "Receipt_code", DtpRcptDt.Value);

            string[] res = db.ExecuteQueries("Insert into mas_acc_receipt values ('" + rcptno + "','" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','" + db.GetFinYr(DtpRcptDt.Value) + "'," + db.ExtractCode(CmbPartyType.Text) + "," + db.ExtractCode(CmbRegion.Text) + "," + db.ExtractCode(CmbParty.Text) + "," + TxtAmount.Text.Trim() + "," + db.ExtractCode(CmbPayMode.Text) + ",'" + TxtRefNo.Text.Trim() + "','" + DtpRefDt.Value.ToString("dd-MMM-yyyy") + "'," + db.ExtractCode(CmbBank.Text) + ",'" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            res = db.ExecuteQueries("Insert into mas_acc_reconcillation values (" + db.GetNewID("mas_acc_reconcillation", "recon_code") + ",'" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','" + db.GetFinYr(DtpRcptDt.Value) + "'," + db.ExtractCode(CmbPartyType.Text) + "," + db.ExtractCode(CmbParty.Text) + "," + db.ExtractCode(CmbRegion.Text) + ",'" + rcptno + "','" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','R'," + TxtAmount.Text.Trim() + ",null,null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                db.ExecuteQueries("Delete from mas_acc_receipt where receipt_code='" + rcptno + "'");
                return;
            }

            MessageBox.Show("Successfully Saved with Receipt No. " + rcptno, "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            TxtAmount.Text   = "";
            TxtRcptCode.Text = db.GetAccCode("RC", "mas_acc_receipt", "Receipt_code", DtpRcptDt.Value);
            TxtRefNo.Text    = "";
            TxtRemarks.Text  = "";
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtAddress.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Address", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtCity.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid City Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtStateCode.Text.Trim().Length <= 0)
            {
                MessageBox.Show("State Code Mandatory", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TxtPANNo.Text.Trim().Length > 0)
            {
                if (TxtPANNo.Text.Trim().Length != 10)
                {
                    MessageBox.Show("Invalid PAN Number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (TxtGSTNo.Text.Trim().Length > 0)
                {
                    if (TxtPANNo.Text.Trim() != TxtGSTNo.Text.Trim().Substring(2, 10))
                    {
                        MessageBox.Show("Invalid PAN Number or GST Number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            if (TxtGSTNo.Text.Trim().Length > 0)
            {
                if (TxtGSTNo.Text.Trim().Length != 15)
                {
                    MessageBox.Show("Invalid GST number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (TxtGSTNo.Text.Trim().Substring(0, 2) != TxtStateCode.Text.Trim())
                {
                    MessageBox.Show("Invalid GST Number or State Code", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            string ptype = "";

            if (CmbPartyType.Text == "Agency")
            {
                ptype = "AG";
            }
            else
            {
                ptype = "CL";
            }
            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_address_book set address='" + TxtAddress.Text.Trim() + "', Town_City='" + TxtCity.Text.Trim() + "', PINCOde='" + TxtPIN.Text.Trim() + "',Telephone='" + TxtTelPh.Text.Trim() + "',Fax='" + TxtFax.Text.Trim() + "',Mobile='" + TxtMobile.Text.Trim() + "',Email_ID='" + TxtMail.Text.Trim() + "', State_Code='" + TxtStateCode.Text.Trim() + "',GST_No='" + TxtGSTNo.Text.Trim() + "', PAN_No='" + TxtPANNo.Text.Trim() + "', Remarks='" + TxtRemarks.Text.Trim() + "', Modified_by='" + GlobalClass.UserName + "', Modified_date=sysdate where address_id=" + LblPK.Text).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Insert into mas_address_book values (" + db.GetNewID("Mas_Address_book", "Address_id") + "," + db.ExtractCode(CmbRegion.Text) + ",'" + ptype + "'," + db.ExtractCode(CmbPartyName.Text) + ",'" + TxtAddress.Text.Trim() + "','" + TxtCity.Text.Trim() + "','" + TxtPIN.Text + "','" + TxtTelPh.Text.Trim() + "','" + TxtFax.Text.Trim() + "','" + TxtMobile.Text.Trim() + "','" + TxtMail.Text.Trim() + "','" + TxtStateCode.Text.Trim() + "','" + TxtGSTNo.Text.Trim() + "','" + TxtPANNo.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(',');
            }
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LblPK.Text        = "";
                TxtAddress.Text   = "";
                TxtCity.Text      = "";
                TxtPIN.Text       = "";
                TxtTelPh.Text     = "";
                TxtFax.Text       = "";
                TxtMobile.Text    = "";
                TxtMail.Text      = "";
                TxtRemarks.Text   = "";
                TxtStateCode.Text = "";
                TxtGSTNo.Text     = "";
                TxtPANNo.Text     = "";
            }
        }
コード例 #12
0
        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();
            }
        }
コード例 #13
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (TxtVNo.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Enter Voucher Number", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtVNo.Focus();
                return;
            }
            if (TxtName.Text.Trim().Length <= 2)
            {
                MessageBox.Show("Invalid Subcriber Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtName.Focus();
                return;
            }

            if (TxtAdd.Text.Trim().Length <= 5)
            {
                MessageBox.Show("Invalid Subscriber Address", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAdd.Focus();
                return;
            }

            if (TxtPIN.Text.Trim().Length > 0)
            {
                if (TxtPIN.Text.Trim().Length != 6)
                {
                    MessageBox.Show("Invalid PIN Code", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtPIN.Focus();
                    return;
                }
            }

            if (Convert.ToInt32(db.ExtractCode(CmbExecutive.Text)) <= 0)
            {
                MessageBox.Show("Invalid Executive Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbExecutive.Focus();
                return;
            }

            if (Convert.ToInt16(TxtQty.Text) <= 0)
            {
                MessageBox.Show("Invalid Quantity", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtQty.Focus();
                return;
            }

            DataSet ds;

            ds = db.GetTableData("Select * from mas_sub_pay_details where voucher_no='" + TxtOldVNo.Text.Trim() + "' and '01-" + DtpMnthFrm.Value.ToString("MMM-yy") + "' between period_frm and period_to");
            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("Invalid Previous Subscription Voucher Number", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //if (TxtPhone.Text.Trim().Length < 10)
            //{
            //    MessageBox.Show("Invalid Mobile Number", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    TxtAdd.Focus();
            //    return;
            //}

            int issues = 0;

            ds = db.GetTableData("Select * from MAS_SUB_TYPE where sub_type_id=" + db.ExtractCode(CmbSubType.Text));
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    issues = Convert.ToInt32(dr["issues"].ToString());
                }
            }
            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_subscriptions set state_id=" + db.ExtractCode(CmbState.Text) + ", district_id=" + db.ExtractCode(CmbDistrict.Text) + ", region_id=" + db.ExtractCode(CmbRegion.Text) + ",  sub_name='" + TxtName.Text + "',address='" + TxtAdd.Text + "',city_name='" + TxtCity.Text + "',pin_code='" + TxtPIN.Text + "',email_id='" + TxtEMail.Text + "',contact_no='" + TxtPhone.Text + "',remarks='" + TxtRemarks.Text + "',modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_id=" + LblPK.Text).Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Updation Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                res = db.ExecuteQueries("Update MAS_SUB_PAY_DETAILS set executive_id=" + db.ExtractCode(CmbExecutive.Text) + ", voucher_no='" + TxtVNo.Text.Trim() + "', prev_voucher_no='" + TxtOldVNo.Text.Trim() + "', period_frm='01-" + DtpMnthFrm.Value.ToString("MMM-yyyy") + "', period_to='01-" + DtpMnthTo.Value.ToString("MMM-yyyy") + "', sub_type=" + db.ExtractCode(CmbSubType.Text) + ", Amount=" + TxtAmt.Text + ", sponsor_id=" + db.ExtractCode(CmbSponsor.Text) + ", Quantity=" + TxtQty.Text + ", Modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_id=" + LblPK.Text.Trim() + " and voucher_no='" + TxtVNo.Text.Trim() + "'").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Updation Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                int sid = db.GetNewID("mas_subscriptions", "sub_id");
                res = db.ExecuteQueries("Insert into mas_subscriptions values (" + sid.ToString() + "," + db.ExtractCode(CmbState.Text) + "," + db.ExtractCode(CmbDistrict.Text) + "," + db.ExtractCode(CmbRegion.Text) + ",'" + TxtName.Text + "','" + TxtAdd.Text + "','" + TxtCity.Text + "','" + TxtPIN.Text + "','" + TxtEMail.Text + "','" + TxtPhone.Text + "','" + TxtRemarks.Text + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                res = db.ExecuteQueries("Insert into mas_sub_pay_details values (" + db.GetNewID("mas_sub_pay_details", "pay_id") + "," + sid.ToString() + "," + db.ExtractCode(CmbExecutive.Text) + ", '" + TxtVNo.Text.Trim() + "','" + TxtOldVNo.Text.Trim() + "','01-" + DtpMnthFrm.Value.ToString("MMM-yyyy") + "','01-" + DtpMnthTo.Value.ToString("MMM-yyyy") + "'," + db.ExtractCode(CmbSubType.Text) + "," + TxtAmt.Text + "," + db.ExtractCode(CmbSponsor.Text) + "," + TxtQty.Text + ",null,'" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    db.ExecuteQueries("Delete from mas_subscriptions where sub_id=" + sid.ToString());
                    return;
                }
            }

            MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            TxtName.Text    = "";
            TxtAdd.Text     = "";
            TxtCity.Text    = "";
            TxtEMail.Text   = "";
            TxtPhone.Text   = "";
            TxtPIN.Text     = "";
            TxtRemarks.Text = "";
            TxtVNo.Text     = vouchernumber();
            TxtVNo.Focus();
            TxtOldVNo.Text           = "";
            LblPK.Text               = "";
            DtpMnthFrm.Enabled       = true;
            CmbSponsor.SelectedIndex = 0;
            DtpMnthFrm.MinDate       = Convert.ToDateTime("01-" + DateTime.Now.ToString("MMM-yyyy"));
            DtpMnthFrm.Value         = Convert.ToDateTime("01-" + DateTime.Now.ToString("MMM-yyyy"));
            TxtQty.Text              = "1";
            db.TxtAutoFill(TxtCity, "mas_subscriptions", "city_name");
            db.TxtAutoFill(TxtPIN, "mas_subscriptions", "PIN_CODE");
            db.TxtAutoFill(TxtOldVNo, "mas_sub_pay_details", "voucher_no");
        }
コード例 #14
0
ファイル: FrmClient.cs プロジェクト: bandirajesh83/HDMagazine
        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        = "";
            }
        }