Пример #1
0
    void selectpurchase()
    {
        inireader ir = new inireader(gv.inifile);

        try
        {
            gv.conn.Open();
            gv.ds  = new DataSet();
            gv.sql = "select head, id from spacc where head = '" + ir.readstring("item", "defaultpurchaseac") + "'";
            Debug.WriteLine(gv.sql);
            gv.adap = new OleDbDataAdapter(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "purchaseac");
            if (gv.ds.Tables[0].Rows.Count > 0)
            {
                purchaseacnum = Convert.ToInt32(gv.ds.Tables[0].Rows[0]["id"]);
                lbl7.Text     = gv.ds.Tables[0].Rows[0]["head"].ToString();
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
        finally
        {
            gv.conn.Close();
        }
    }
Пример #2
0
    public void print()
    {
        try
        {
            gv.conn.Open();
            gv.ds   = new DataSet();
            gv.adap = new OleDbDataAdapter();
            gv.sql  = " select bill.brandname from bill where id = " + gv.billid;
            Debug.WriteLine(gv.sql);
            gv.adap.SelectCommand = new OleDbCommand(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "firm");
            //brandname = gv.ds.Tables[0].Rows[0][0].ToString();
            //format(item.id,'00000') as [Bar Code]
            gv.sql = " select item.itemname as [Item Name],item.id ,item.barcode as [Bar Code],itemb.mrp as [MRP],itemb.pkgdate as [PKG Date]" +
                     " from itemb " +
                     "inner join item on item.id=itemb.itemid";
            Debug.WriteLine(gv.sql);
            gv.adap.SelectCommand = new OleDbCommand(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "item");
            //			DataColumn boolcol = new DataColumn("Select",typeof(bool));
            //			boolcol.DefaultValue = false;
            //			gv.ds.Tables[1].Columns.Add(boolcol);
            DataColumn doublecol = new DataColumn("Number of Sticker", typeof(double));
            doublecol.DefaultValue = 0;
            gv.ds.Tables[1].Columns.Add(doublecol);

            DataTable dt = new DataTable();

            searchbox.Show("Select Item Name and Number of Sticker", null, gv.ds.Tables[1], ref dt, "[Number of Sticker] > 0", "[Item Name]", "");
            dtchoice = dt;
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
        finally
        {
            gv.conn.Close();
        }

        nostk      = 1;
        pricounter = 1;
        recnum     = 0;
        bool.TryParse(ir.readstring("printing", "dateinlabel"), out printdate);

        doc = new PrintDocument();

        doc.BeginPrint += new PrintEventHandler(docbeginprint);
        doc.PrintPage  += new PrintPageEventHandler(docprint);

        /*
         *      PrintPreviewDialog ppd = new PrintPreviewDialog();
         *      ppd.Document = doc;
         *      ppd.ShowDialog();
         *      /**/
        doc.Print();

        doc = null;
    }
Пример #3
0
    public invoice(int invoiceid)
    {
        WindowState = FormWindowState.Maximized;
        AutoScroll  = true;

        lbl1          = new Label();
        lbl1.Text     = "Bill Book";
        lbl1.Location = new Point(0, 0);
        lbl1.Parent   = this;

        lbl2          = new Label();
        lbl2.Location = new Point(100, 0);
        lbl2.Text     = "";
        lbl2.Parent   = this;

        lbl3          = new Label();
        lbl3.Text     = "Series";
        lbl3.Location = new Point(240, 0);
        lbl3.Parent   = this;

        lbl4          = new Label();
        lbl4.Location = new Point(340, 0);
        lbl4.Text     = "";
        lbl4.Parent   = this;

        lbl5          = new Label();
        lbl5.Text     = "Party Name";
        lbl5.Location = new Point(0, 30);
        lbl5.Parent   = this;

        lbl6          = new Label();
        lbl6.Location = new Point(100, 30);
        lbl6.Parent   = this;

        lbl7          = new Label();
        lbl7.Location = new Point(0, 60);
        lbl7.Text     = "Bill Number";
        lbl7.Parent   = this;

        tb1             = new TextBox();
        tb1.Location    = new Point(100, 60);
        tb1.Validating += new CancelEventHandler(tb1validating);
        tb1.Validated  += new EventHandler(tb1validated);
        tb1.Parent      = this;

        err = new ErrorProvider();

        lbl8          = new Label();
        lbl8.Location = new Point(240, 60);
        lbl8.Text     = "Date";
        lbl8.Parent   = this;

        dtp1          = new DateTimePicker();
        dtp1.Location = new Point(340, 60);
        dtp1.Parent   = this;

        chb1            = new CheckBox();
        chb1.Text       = "Credit Invoice";
        chb1.Checked    = true;
        chb1.CheckAlign = ContentAlignment.MiddleRight;
        chb1.Location   = new Point(0, 90);
        chb1.Parent     = this;

        lbl10          = new Label();
        lbl10.Location = new Point(240, 90);
        lbl10.Text     = "Sale Type";
        lbl10.Parent   = this;

        cb2          = new ComboBox();
        cb2.Location = new Point(340, 90);
        cb2.Items.Add("VAT");
        cb2.Items.Add("CST");
        cb2.SelectedIndex = 0;
        cb2.Parent        = this;

        chb2            = new CheckBox();
        chb2.Text       = "Against C Form";
        chb2.CheckAlign = ContentAlignment.MiddleRight;
        chb2.Location   = new Point(0, 120);
        chb2.Parent     = this;

        dgv          = new DataGridView();
        dgv.Location = new Point(0, 150);
        dgv.Width    = 540;
        //dgv.EditMode = DataGridViewEditMode.EditOnEnter;
        dgv.CellValidating        += new DataGridViewCellValidatingEventHandler(cellvalidating);
        dgv.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(editingcontrolshowing);
        dgv.Parent = this;

        lbl12          = new Label();
        lbl12.Text     = "Amount";
        lbl12.Location = new Point(0, 320);
        lbl12.Parent   = this;

        lbl13          = new Label();
        lbl13.Location = new Point(100, 320);
        lbl13.Parent   = this;

        lbl14          = new Label();
        lbl14.Location = new Point(0, 350);
        lbl14.Text     = "Tax Amount";
        lbl14.Parent   = this;

        lbl15          = new Label();
        lbl15.Location = new Point(100, 350);
        lbl15.Text     = "";
        lbl15.Parent   = this;

        lbl16          = new Label();
        lbl16.Location = new Point(0, 380);
        lbl16.Text     = "Surcharge Amount";
        lbl16.Parent   = this;

        lbl17          = new Label();
        lbl17.Location = new Point(100, 380);
        lbl17.Text     = "";
        lbl17.Parent   = this;

        lbl18          = new Label();
        lbl18.Location = new Point(240, 320);
        lbl18.Text     = "Cash Discount (Rs.)";
        lbl18.Parent   = this;

        tb2          = new TextBox();
        tb2.Location = new Point(340, 320);
        tb2.Parent   = this;

        lbl19          = new Label();
        lbl19.Location = new Point(240, 350);
        lbl19.Text     = "Invoice Amount";
        lbl19.Parent   = this;

        lbl21          = new Label();
        lbl21.Location = new Point(340, 350);
        lbl21.Text     = "";
        lbl21.Parent   = this;

        lbl22          = new Label();
        lbl22.Location = new Point(0, 410);
        lbl22.Text     = "Error:";
        lbl22.Parent   = this;

        btn1          = new Button();
        btn1.Text     = "First";
        btn1.Location = new Point(0, 440);
        btn1.Click   += new EventHandler(firclick);
        btn1.Parent   = this;

        btn2          = new Button();
        btn2.Text     = "Previous";
        btn2.Location = new Point(100, 440);
        btn2.Click   += new EventHandler(preclick);
        btn2.Parent   = this;

        tb3          = new TextBox();
        tb3.Location = new Point(200, 440);
        tb3.Width    = 75;
        tb3.Parent   = this;

        btn3          = new Button();
        btn3.Text     = "Next";
        btn3.Location = new Point(300, 440);
        btn3.Click   += new EventHandler(nexclick);
        btn3.Parent   = this;

        btn4          = new Button();
        btn4.Text     = "Last";
        btn4.Location = new Point(400, 440);
        btn4.Click   += new EventHandler(lasclick);
        btn4.Parent   = this;

        btn5          = new Button();
        btn5.Text     = "Insert";
        btn5.Location = new Point(100, 470);
        btn5.Click   += new EventHandler(insclick);
        btn5.Parent   = this;

        btn6          = new Button();
        btn6.Text     = "Update";
        btn6.Location = new Point(200, 470);
        btn6.Click   += new EventHandler(updclick);
        btn6.Parent   = this;

        btn7          = new Button();
        btn7.Text     = "Delete";
        btn7.Location = new Point(300, 470);
        btn7.Click   += new EventHandler(delclick);
        btn7.Parent   = this;

        btn8          = new Button();
        btn8.Text     = "New";
        btn8.Location = new Point(200, 500);
        btn8.Click   += new EventHandler(newclick);
        btn8.Parent   = this;

        btn9          = new Button();
        btn9.Text     = "Goto";
        btn9.Location = new Point(200, 530);
        btn9.Click   += new EventHandler(gotclick);
        btn9.Parent   = this;

        btn10          = new Button();
        btn10.Text     = "Select Bill Book";
        btn10.Location = new Point(0, 500);
        btn10.Width    = 175;
        btn10.Click   += new EventHandler(selbbclick);
        btn10.Parent   = this;

        btn11          = new Button();
        btn11.Text     = "Select Party";
        btn11.Location = new Point(0, 530);
        btn11.Width    = 175;
        btn11.Click   += new EventHandler(selpartyclick);
        btn11.Parent   = this;

        btn12          = new Button();
        btn12.Text     = "Print";
        btn12.Location = new Point(300, 500);
        btn12.Click   += new EventHandler(priclick);
        btn12.Parent   = this;

        bool.TryParse(ir.readstring("invoicing", "rateinclusive"), out inclusive);

        recstartstop();
        num = reccount;
        num++;
        if (invoiceid != 0)
        {
            num = invoiceid;           //if choose to open a particular invoice externally
        }
        tb3.Text = num + " of " + reccount;

        fillform();

        if (invoiceid == 0)
        {
            selectbillbook();
            selectbillnumber();
            billnum++;
            tb1.Text = billnum.ToString();
            selectparty();
        }
    }
Пример #4
0
    public configuration()
    {
        WindowState = FormWindowState.Maximized;

        ofd = new OpenFileDialog();
        ofd.RestoreDirectory = true;
        ofd.DefaultExt       = "rpt";
        ofd.Filter           = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
        ofd.FilterIndex      = 0;
        ofd.CheckFileExists  = true;
        ofd.CheckPathExists  = true;
        ofd.Multiselect      = false;
        ofd.ReadOnlyChecked  = true;
        ofd.ShowReadOnly     = true;


        tc        = new TabControl();
        tc.Size   = new Size(600, 500);
        tc.Parent = this;

        tp1        = new TabPage();
        tp1.Text   = "General Configuration";
        tp1.Parent = tc;

        tp2        = new TabPage();
        tp2.Text   = "Report Files";
        tp2.Parent = tc;

        chb1            = new CheckBox();
        chb1.Location   = new Point(0, 0);
        chb1.Text       = "Print Date in Barcode Sticker";
        chb1.CheckAlign = ContentAlignment.MiddleRight;
        chb1.Width      = 250;
        chb1.Parent     = tp1;

        lbl1          = new Label();
        lbl1.Location = new Point(0, 30);
        lbl1.Text     = "Default Sale A/c";
        lbl1.Width    = 125;
        lbl1.Parent   = tp1;

        cb1          = new ComboBox();
        cb1.Location = new Point(150, 30);
        cb1.Width    = 300;
        cb1.Parent   = tp1;

        lbl2          = new Label();
        lbl2.Location = new Point(0, 60);
        lbl2.Text     = "Default Purchase A/c";
        lbl2.Width    = 125;
        lbl2.Parent   = tp1;

        cb2          = new ComboBox();
        cb2.Location = new Point(150, 60);
        cb2.Width    = 300;
        cb2.Parent   = tp1;

        lbl3          = new Label();
        lbl3.Location = new Point(0, 90);
        lbl3.Text     = "Selected Language";
        lbl3.Width    = 125;
        lbl3.Parent   = tp1;

        cb3          = new ComboBox();
        cb3.Location = new Point(150, 90);
        cb3.Width    = 300;
        cb3.Parent   = tp1;

        lbl4          = new Label();
        lbl4.Location = new Point(0, 0);
        lbl4.Text     = "Invoice Report File";
        lbl4.Width    = 125;
        lbl4.Parent   = tp2;

        tb1          = new TextBox();
        tb1.Location = new Point(150, 0);
        tb1.Width    = 300;
        tb1.Parent   = tp2;

        btn1          = new Button();
        btn1.Location = new Point(500, 0);
        btn1.Text     = "Open File";
        btn1.Click   += new EventHandler(rptinvclick);
        btn1.Parent   = tp2;

        lbl5          = new Label();
        lbl5.Location = new Point(0, 30);
        lbl5.Text     = "Claim Report File";
        lbl5.Parent   = tp2;

        tb2          = new TextBox();
        tb2.Location = new Point(150, 30);
        tb2.Width    = 300;
        tb2.Parent   = tp2;

        btn2          = new Button();
        btn2.Location = new Point(500, 30);
        btn2.Text     = "Open File";
        btn2.Click   += new EventHandler(rptclaimclick);
        btn2.Parent   = tp2;

        chb2            = new CheckBox();
        chb2.Location   = new Point(0, 120);
        chb2.Text       = "Batch wise stock and sale facility ";
        chb2.CheckAlign = ContentAlignment.MiddleRight;
        chb2.Width      = 250;
        chb2.Parent     = tp1;

        lbl6          = new Label();
        lbl6.Location = new Point(0, 150);
        lbl6.Text     = "Data Base File";
        lbl6.Parent   = tp1;

        tb3          = new TextBox();
        tb3.Location = new Point(150, 150);
        tb3.Width    = 300;
        tb3.Parent   = tp1;

        btn3          = new Button();
        btn3.Location = new Point(500, 150);
        btn3.Text     = "Open File";
        btn3.Click   += new EventHandler(seledbclick);
        btn3.Parent   = tp1;

        btn4          = new Button();
        btn4.Location = new Point(100, 500);
        btn4.Text     = "Save";
        btn4.Click   += new EventHandler(savclick);
        btn4.Parent   = this;

        //	fill combos
        try
        {
            gv.conn.Open();
            gv.ds   = new DataSet();
            gv.sql  = "select head from spacc where type ='S'";
            gv.adap = new OleDbDataAdapter(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "saleac");
            cb1.DataSource    = gv.ds.Tables[0];
            cb1.DisplayMember = "head";

            gv.ds   = new DataSet();
            gv.sql  = "select head from spacc where type ='P'";
            gv.adap = new OleDbDataAdapter(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "purchaseac");
            cb2.DataSource    = gv.ds.Tables[0];
            cb2.DisplayMember = "head";
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
        finally
        {
            gv.conn.Close();
        }
        cb3.Items.Add("en-US");
        cb3.Items.Add("hi-IN");
        cb3.Items.Add("pr-BR");
        //	read settings
        bool chkb;

        bool.TryParse(ir.readstring("printing", "dateinlabel"), out chkb);
        chb1.Checked = chkb;
        bool.TryParse(ir.readstring("invoicing", "batchwisestockandsale"), out chkb);
        chb2.Checked      = chkb;
        cb1.SelectedIndex = cb1.FindStringExact(ir.readstring("item", "defaultsaleac"));
        cb2.SelectedIndex = cb2.FindStringExact(ir.readstring("item", "defaultpurchaseac"));
        cb3.SelectedIndex = cb3.FindStringExact(ir.readstring("general", "language"));
        tb1.Text          = ir.readstring("reportfiles", "invoice");
        tb2.Text          = ir.readstring("reportfiles", "medicalclaim");
        tb3.Text          = ir.readstring("database", "datafile");
    }