Ejemplo n.º 1
0
        private void FrmClient_Load(object sender, EventArgs e)
        {
            cs.FrmStyle(this);
            db.TxtAutoFill(TxtName, "MAS_CLIENT", "CLIENT_NAME");
            TxtCode.Text = db.GetNewID("Mas_CLIENT", "CLIENT_Code").ToString();

            DataSet ds = db.GetTableData("Select state_code,state_name||'('||state_code||')' state_name, action_type from mas_gst_state");

            CmbState.DataSource    = ds.Tables[0];
            CmbState.DisplayMember = "state_name";
            CmbState.ValueMember   = "state_code";

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_CLIENT where CLIENT_Code=" + LblPK.Text);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        TxtCode.Text = dr["CLIENT_Code"].ToString();
                        TxtName.Text = dr["CLIENT_Name"].ToString();
                        TxtComm.Text = dr["CLIENT_Commission"].ToString();
                        if (dr["active_flag"].ToString() == "Y")
                        {
                            ChkActive.Checked = true;
                        }
                        else
                        {
                            ChkActive.Checked = false;
                        }
                        DataSet ds1 = db.GetTableData("Select * from mas_gst_state where state_code=" + dr["state_code"].ToString());
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            CmbState.Text = dr1["State_name"].ToString() + "(" + dr1["State_Code"].ToString() + ")";
                        }
                        TxtGSTNo.Text   = dr["Gst_No"].ToString();
                        TxtPANNo.Text   = dr["PAN_No"].ToString();
                        TxtRemarks.Text = dr["Remarks"].ToString();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void FrmSubscription_Load(object sender, EventArgs e)
        {
            cs.FrmStyle(this);

            DataSet ds = db.GetTableData("select sub_type_id, sub_type_name || '(' || sub_type_id || ')' sub_type_name, Action_type from mas_sub_type order by sub_type_name");

            CmbSubType.DataSource    = ds.Tables[0];
            CmbSubType.ValueMember   = "sub_type_id";
            CmbSubType.DisplayMember = "sub_type_name";


            ds = db.GetTableData("select state_id, state_name || '(' || state_id || ')' State_Name, Action_type from mas_state order by state_name");
            CmbState.DataSource    = ds.Tables[0];
            CmbState.ValueMember   = "State_ID";
            CmbState.DisplayMember = "State_Name";

            ds = db.GetTableData("select region_id, region_name || '('||region_id||')' region_name, action_type from mas_region order by region_name");
            CmbRegion.DataSource    = ds.Tables[0];
            CmbRegion.DisplayMember = "Region_name";
            CmbRegion.ValueMember   = "Region_id";

            ds = db.GetTableData("Select executive_id, executive_name || '('||executive_id||')' executive_name, action_type from mas_executive order by executive_name");
            CmbExecutive.DataSource    = ds.Tables[0];
            CmbExecutive.DisplayMember = "executive_name";
            CmbExecutive.ValueMember   = "executive_id";

            ds = db.GetTableData("select Sponsor_id, Sponsor_name || ',' || sponsor_address ||'(' || sponsor_id || ')' sponsor_name, action_type from mas_sponsor order by sponsor_name");
            CmbSponsor.DataSource    = ds.Tables[0];
            CmbSponsor.DisplayMember = "sponsor_name";
            CmbSponsor.ValueMember   = "sponsor_id";

            TxtVNo.Text = vouchernumber();
            db.TxtAutoFill(TxtCity, "mas_subscriptions", "city_name");
            db.TxtAutoFill(TxtPIN, "mas_subscriptions", "PIN_CODE");
            db.TxtAutoFill(TxtOldVNo, "mas_sub_pay_details", "voucher_no");


            if (LblPK.Text.Length > 0)
            {
                ds = db.GetTableData("select * from mas_sub_issues where pay_id=" + LblPK.Text.Trim() + " and invoice_code is not null");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("Invoice already generated for this subscriptions", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ds = db.GetTableData("select * from vew_mas_subscriptions ms where sub_id=" + LblPK.Text.Trim());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        LblPK.Text = dr["sub_id"].ToString();
                        DataSet ds1 = db.GetTableData("select * from mas_state where state_id=" + dr["state_id"].ToString());
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            CmbState.Text = dr1["State_Name"].ToString() + "(" + dr1["State_ID"].ToString() + ")";
                        }

                        ds1 = db.GetTableData("select * from mas_district where district_id=" + dr["District_ID"].ToString());
                        foreach (DataRow dr2 in ds1.Tables[0].Rows)
                        {
                            CmbDistrict.Text = dr2["District_Name"].ToString() + "(" + dr2["District_ID"].ToString() + ")";
                        }

                        ds1 = db.GetTableData("select * from MAS_SUB_TYPE where sub_type_id=" + dr["sub_type"].ToString());
                        foreach (DataRow dr3 in ds1.Tables[0].Rows)
                        {
                            CmbSubType.Text = dr3["sub_type_name"].ToString() + "(" + dr3["sub_type_id"].ToString() + ")";
                        }

                        ds1 = db.GetTableData("select * from mas_region where region_id=" + dr["Region_ID"].ToString());
                        foreach (DataRow dr4 in ds1.Tables[0].Rows)
                        {
                            CmbRegion.Text = dr4["region_name"].ToString() + "(" + dr4["Region_ID"].ToString() + ")";
                        }

                        ds1 = db.GetTableData("Select * from mas_executive where executive_id=" + dr["executive_id"].ToString());
                        foreach (DataRow dr5 in ds1.Tables[0].Rows)
                        {
                            CmbExecutive.Text = dr5["executive_name"].ToString() + "(" + dr5["executive_id"].ToString() + ")";
                        }


                        DtpMnthFrm.Value = Convert.ToDateTime(dr["Period_frm"].ToString());
                        DtpMnthTo.Value  = Convert.ToDateTime(dr["Period_to"].ToString());
                        TxtAdd.Text      = dr["Address"].ToString();
                        TxtCity.Text     = dr["City_Name"].ToString();
                        TxtEMail.Text    = dr["Email_ID"].ToString();
                        TxtName.Text     = dr["sub_name"].ToString();
                        TxtPhone.Text    = dr["Contact_no"].ToString();
                        TxtPIN.Text      = dr["PIN_Code"].ToString();
                        TxtRemarks.Text  = dr["Remarks"].ToString();
                        TxtVNo.Text      = dr["Voucher_No"].ToString();
                        TxtOldVNo.Text   = dr["prev_voucher_no"].ToString();
                        CmbSponsor.Text  = dr["sponsor_name"].ToString() + "," + dr["sponsor_address"].ToString() + "(" + dr["sponsor_id"].ToString() + ")";

                        ds1 = db.GetTableData("select * from mas_sub_issues where sub_id=" + dr["sub_id"].ToString());
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            DtpMnthFrm.Enabled = false;
                        }
                        else
                        {
                            DtpMnthFrm.Enabled = true;
                        }
                    }
                }
            }
        }