Exemplo n.º 1
0
        private void Report()
        {
            double opamount = Convert.ToDouble(textBox1.Text);
            double clamount = Convert.ToDouble(textBox2.Text);


            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("     Profit And Loss Account     ");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("  Profit And Loss Account   "));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();
            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" Expenses "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Account Rs "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);

            cell.addObject(new CHTMLText(" Income "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Account Rs "));
            row.addObject(cell);
            table.addObject(row);

            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText(" To Opening stock  "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(opamount.ToString()));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);

            row.backgroundColor = "red";
            table.addObject(row);
            DataTable dt      = PandL.ProfitAndLoss2();
            DataTable dt1     = PandL.ProfitAndLoss1();
            double    crTotal = 0;
            double    drTotal = 0;
            int       crow    = dt1.Rows.Count;
            int       drow    = dt.Rows.Count;
            int       max     = Math.Max(drow, crow);
            bool      flag1   = false;
            bool      flag2   = false;

            bool equal     = (drow == crow) ? true : false;
            bool drowempty = drow == 0 ? true : false;
            bool crowempty = crow == 0 ? true : false;
            int  i         = 0;

            while (i < max)
            {
                row = new CHTMLTableRow();
                if (drow < max)
                {
                    if (i == drow)
                    {
                        flag1 = true;
                    }
                }
                if (crow < max)
                {
                    if (i == crow)
                    {
                        flag2 = true;
                    }
                }

                if (flag1 == true && equal == false)
                {
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                }

                if (i < drow && drowempty == false)
                {
                    DataRow dr   = dt.Rows[i];
                    double  amnt = double.Parse(dr["Total"].ToString());


                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("To " + dr["S_DESC"].ToString()));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(amnt.ToString()));
                    row.addObject(cell);

                    drTotal += amnt;
                }
                if (flag2 == true && equal == false)
                {
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText(" "));
                    row.addObject(cell);
                }

                if (i < crow && crowempty == false)
                {
                    DataRow dr = dt1.Rows[i];

                    double amnt = double.Parse(dr["Total"].ToString());

                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("By " + dr["S_DESC"].ToString()));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    amnt = -amnt;

                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(amnt.ToString()));
                    row.addObject(cell);
                    crTotal += amnt;
                }
                table.addObject(row);
                i++;
            }



            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("  By Closing stock  "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(clamount.ToString()));
            row.addObject(cell);
            table.addObject(row);

            crTotal += clamount;
            drTotal += opamount;

            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText(" To profit and loss carried down to balance sheet "));
            row.addObject(cell);


            diff = drTotal - crTotal;

            if (drTotal > crTotal)
            {
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText());
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.setHorizontalAlign(alignment.RIGHT);
                cell.addObject(new CHTMLText((diff).ToString()));
                row.addObject(cell);
                crTotal += diff;
            }
            else
            {
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.setHorizontalAlign(alignment.RIGHT);
                cell.addObject(new CHTMLText((-diff).ToString()));
                row.addObject(cell);
                drTotal += (-diff);
            }

            table.addObject(row);

            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("Total"));
            row.addObject(cell);


            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(drTotal.ToString()));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(crTotal.ToString()));
            row.addObject(cell);
            table.addObject(row);
            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            // System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);

            // string prst = config.AppSettings.Settings["FAConnectionString"].Value;
            //  config.Save(ConfigurationSaveMode.Modified);
            //  ConfigurationManager.RefreshSection("appSettings");


            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("I AM A fool");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("HOO"));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" MULTIPLICAND "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" MULTIPLIER "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" PRODUCT "));
            row.addObject(cell);
            row.backgroundColor = "red";
            table.addObject(row);

            for (int i = 0; i < 100; ++i)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(i.ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);
                int rst = 16;
                cell.addObject(new CHTMLText(rst.ToString()));
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.HEADING);
                rst  = i * 16;
                cell.addObject(new CHTMLText(rst.ToString()));
                row.addObject(cell);

                table.addObject(row);
            }

            ds.addObject(table);

            // CHTMLLink htmllink = new CHTMLLink();
            // htmllink.setHREF("http://www.google.com");
            //  htmllink.addObject(new CHTMLText("Google"));
            //  ds.addObject(txt);
            // ds.addObject(hr);
            //  ds.addObject(table);

            //  ds.addObject(input);
            //  ds.addObject(new CHTMLLineBreak());
            // ds.addObject(htmllink);

            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 3
0
        private void Report()
        {
            double closingstock = Convert.ToDouble(clstocktxt.Text);
            double pft          = Convert.ToDouble(pltxt.Text);
            double crTotal      = 0;
            double drTotal      = 0;
            bool   flag1        = false;
            bool   flag2        = false;
            bool   equal        = false;

            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText(" BalanceSheet  ");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText(" BalanceSheet "));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();
            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("Liabilities "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Account Rs "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);

            cell.addObject(new CHTMLText(" Assets "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Account Rs "));
            row.addObject(cell);
            table.addObject(row);
            row = null;

            if (pft > 0)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText(" Profit "));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.setHorizontalAlign(alignment.RIGHT);
                cell.addObject(new CHTMLText((pft).ToString()));
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText("  "));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText("  "));
                row.addObject(cell);
                table.addObject(row);
                row      = null;
                crTotal += (pft);
            }
            else if (pft < 0)
            {
                row = new CHTMLTableRow();

                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText("  "));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText("  "));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText("Loss "));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.setHorizontalAlign(alignment.RIGHT);
                cell.addObject(new CHTMLText((-pft).ToString()));
                row.addObject(cell);

                table.addObject(row);
                row      = null;
                drTotal += -pft;
            }


            // row.backgroundColor = "red";
            //table.addObject(row);
            DataTable dt  = Balancesheet.ShowBalance2();
            DataTable dt1 = Balancesheet.ShowBalance1();

            int drow = dt.Rows.Count;
            int crow = dt1.Rows.Count;
            int max  = Math.Max(drow, crow);

            equal = (drow == crow) ? true : false;
            int i = 0;

            while (i < max)
            {
                row = new CHTMLTableRow();

                if (crow < max)
                {
                    if (i == crow)
                    {
                        flag1 = true;;
                    }
                }
                if (drow < max)
                {
                    if (i == drow)
                    {
                        flag2 = true;
                    }
                }



                if (flag1 == true && equal == false)
                {
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                }

                if (i < crow)
                {
                    DataRow dr = dt1.Rows[i];

                    double amnt = double.Parse(dr["Total"].ToString());


                    if (amnt < 0)
                    {
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.setHorizontalAlign(alignment.RIGHT);
                        cell.addObject(new CHTMLText((-amnt).ToString()));
                        row.addObject(cell);

                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("  "));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("  "));
                        row.addObject(cell);

                        crTotal += -amnt;
                    }
                    else
                    {
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("   "));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("  "));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.setHorizontalAlign(alignment.RIGHT);
                        cell.addObject(new CHTMLText((amnt).ToString()));
                        row.addObject(cell);
                        table.addObject(row);
                        row = new CHTMLTableRow();

                        drTotal += (amnt);
                    }
                }
                if (flag2 == true && equal == false)
                {
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("  "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText(" "));
                    row.addObject(cell);
                }


                if (i < drow)
                {
                    DataRow dr   = dt.Rows[i];
                    double  amnt = double.Parse(dr["Total"].ToString());



                    if (amnt > 0)
                    {
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("  "));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText("  "));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.setHorizontalAlign(alignment.RIGHT);
                        cell.addObject(new CHTMLText((amnt).ToString()));
                        row.addObject(cell);

                        drTotal += (amnt);
                    }
                    else if (amnt < 0)
                    {
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                        row.addObject(cell);
                        cell = new CHTMLTableCell(alignment.RIGHT);
                        cell.setHorizontalAlign(alignment.RIGHT);
                        cell.addObject(new CHTMLText((amnt).ToString()));
                        row.addObject(cell);

                        crTotal += (amnt);
                    }
                }
                table.addObject(row);
                row = null;
                i++;
            }


            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("  "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("  "));
            row.addObject(cell);
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("Closing stock"));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(closingstock.ToString()));
            row.addObject(cell);
            table.addObject(row);
            drTotal += closingstock;



            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText("Total"));
            row.addObject(cell);


            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(drTotal.ToString()));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.addObject(new CHTMLText());
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.RIGHT);
            cell.setHorizontalAlign(alignment.RIGHT);
            cell.addObject(new CHTMLText(crTotal.ToString()));
            row.addObject(cell);
            table.addObject(row);

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 4
0
        private void Report100()
        {
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("I AM A fool");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("HOO"));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" MULTIPLICAND "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" MULTIPLIER "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" PRODUCT "));
            row.addObject(cell);
            row.backgroundColor = "red";
            table.addObject(row);

            for (int i = 0; i < 100; ++i)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(i.ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);
                int rst = 16;
                cell.addObject(new CHTMLText(rst.ToString()));
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.HEADING);
                rst  = i * 16;
                cell.addObject(new CHTMLText(rst.ToString()));
                row.addObject(cell);

                table.addObject(row);
            }

            ds.addObject(table);


            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();


            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 5
0
        private void Report2()
        {
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Chart Of Accounts");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("CHART OF ACCOUNTS"));

            CHTMLTableRow row = null;

            CHTMLTableCell cell = null;

            table.addObject(row);

            DataTable dt1 = Group.ListGroup();

            foreach (DataRow dr1 in dt1.Rows)
            {
                string code = dr1["A_CODE"].ToString();
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(code));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);

                cell.addObject(new CHTMLText(dr1["A_DESC"].ToString()));
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                table.addObject(row);

                DataTable dt = SubGroup.GetSubGroupByGroup(code);
                foreach (DataRow dr in dt.Rows)
                {
                    row  = new CHTMLTableRow();
                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText());
                    row.addObject(cell);

                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText(dr["S_CODE"].ToString()));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.HEADING);

                    cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                    row.addObject(cell);


                    table.addObject(row);
                }
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());

                row.addObject(cell);
                table.addObject(row);

                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                table.addObject(row);
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());

                row.addObject(cell);
                table.addObject(row);

                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                table.addObject(row);
            }

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 6
0
        private void Report7()
        {
#if false
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Items");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();
            table.setBorder(1);
            table.setCaption(new CHTMLText("Items"));

            CHTMLTableRow row = null;
            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;


            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" Sl No "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Name of products "));
            row.addObject(cell);

            table.addObject(row);

            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText());

            row.addObject(cell);
            table.addObject(row);

            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText());
            row.addObject(cell);
            table.addObject(row);


            DataTable dt = InventoryLayer.Group.ListGroup();
            int       j  = 0;
            foreach (DataRow dr in dt.Rows)
            {
                j++;
                string code = dr["gcode"].ToString();
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(j.ToString()));
                row.addObject(cell);

                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(dr["gname"].ToString()));
                row.addObject(cell);

                table.addObject(row);



                DataTable dt1 = InventoryLayer.Items.GetItemByGroup(code);
                int       i   = 1;

                foreach (DataRow dr1 in dt1.Rows)
                {
                    row  = new CHTMLTableRow();
                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText());
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText(j + "." + i.ToString()));
                    row.addObject(cell);

                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText(dr1["itemdesc"].ToString()));
                    row.addObject(cell);


                    table.addObject(row);
                    i++;
                }

                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                table.addObject(row);
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText());
                row.addObject(cell);
                table.addObject(row);
            }

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);
            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
#endif
        }
Exemplo n.º 7
0
        private void Report6()
        {
#if false
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Unit");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();
            table.setBorder(1);
            table.setCaption(new CHTMLText(" Unit "));

            CHTMLTableRow row = null;
            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Code "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Name "));
            row.addObject(cell);


            row.backgroundColor = "red";
            table.addObject(row);
            DataTable dt = InventoryLayer.Unit.ListUnit();
            foreach (DataRow dr in dt.Rows)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(dr["UCODE"].ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);

                cell.addObject(new CHTMLText(dr["uname"].ToString()));
                row.addObject(cell);


                table.addObject(row);
            }

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);
            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
#endif
        }
Exemplo n.º 8
0
        private void Report1()
        {
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Financial Accounting Group");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText(" GROUP "));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" Group Code "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" Group Name "));
            row.addObject(cell);


            row.backgroundColor = "red";
            table.addObject(row);
            DataTable dt = Group.ListGroup();

            foreach (DataRow dr in dt.Rows)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(dr["A_CODE"].ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);

                cell.addObject(new CHTMLText(dr["A_DESC"].ToString()));
                row.addObject(cell);


                table.addObject(row);
            }

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 9
0
        private void Report3()
        {
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Trial Balance");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("TRIAL BALANCE"));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Account "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  DR "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  CR "));
            row.addObject(cell);


            row.backgroundColor = "red";
            table.addObject(row);
            DataTable dt      = TrialBalance.TrialTable();
            double    crTotal = 0;
            double    drTotal = 0;

            foreach (DataRow dr in dt.Rows)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.RIGHT);
                cell.addObject(new CHTMLText(dr["S_DESC"].ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.RIGHT);

                double amnt = double.Parse(dr["Total"].ToString());
                if (amnt >= 0)
                {
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(amnt.ToString()));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("   "));
                    row.addObject(cell);
                    drTotal += amnt;
                }
                else if (amnt < 0)
                {
                    amnt = -amnt;
                    cell.addObject(new CHTMLText("   "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(amnt.ToString()));
                    row.addObject(cell);
                    crTotal += amnt;
                }

                table.addObject(row);
            }
            row  = new CHTMLTableRow();
            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("Total"));
            row.addObject(cell);


            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(drTotal.ToString()));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(crTotal.ToString()));
            row.addObject(cell);
            table.addObject(row);
            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }
Exemplo n.º 10
0
        private void Report2(DataTable dt)
        {
            CHTMLDocument ds  = new CHTMLDocument();
            CHTMLText     txt = new CHTMLText("Ledger");

            txt.setItalic(true);
            CHTMLHorizontalRule hr    = new CHTMLHorizontalRule();
            CHTMLInput          input = new CHTMLInput();
            //
            //
            //
            CHTMLTable table = new CHTMLTable();

            table.setBorder(1);
            table.setCaption(new CHTMLText("Ledger Of " + _acc_string));

            CHTMLTableRow row = null;

            row = new CHTMLTableRow();

            CHTMLTableCell cell = null;

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  Date "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText(" Account Name "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  DR "));
            row.addObject(cell);

            cell = new CHTMLTableCell(alignment.HEADING);
            cell.addObject(new CHTMLText("  CR "));
            row.addObject(cell);


            row.backgroundColor = "red";
            table.addObject(row);

            foreach (DataRow dr in dt.Rows)
            {
                row  = new CHTMLTableRow();
                cell = new CHTMLTableCell(alignment.HEADING);
                cell.addObject(new CHTMLText(dr["J_DATE"].ToString()));
                row.addObject(cell);
                cell = new CHTMLTableCell(alignment.HEADING);
                if (dr["J_DRCR"].ToString() == "CR")
                {
                    cell.addObject(new CHTMLText("TO " + dr["S_DESC"].ToString()));
                }
                else
                {
                    cell.addObject(new CHTMLText("BY " + dr["S_DESC"].ToString()));
                }
                row.addObject(cell);
                if (dr["J_DRCR"].ToString() == "CR")
                {
                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(dr["J_AMOUNT"].ToString()));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.addObject(new CHTMLText("   "));
                    row.addObject(cell);
                }
                else
                {
                    cell = new CHTMLTableCell(alignment.HEADING);
                    cell.addObject(new CHTMLText("   "));
                    row.addObject(cell);
                    cell = new CHTMLTableCell(alignment.RIGHT);
                    cell.setHorizontalAlign(alignment.RIGHT);
                    cell.addObject(new CHTMLText(dr["J_AMOUNT"].ToString()));
                    row.addObject(cell);
                }


                table.addObject(row);
            }

            ds.addObject(table);
            string rs = ds.toHTML();

            FileStream   fs = new FileStream(@"C:\temp\a.html", FileMode.Create);
            StreamWriter st = new StreamWriter(fs);

            st.Write(rs);
            st.Close();



            webBrowser1.Navigate(new Uri(@"file://c:\temp\a.html"));
            webBrowser1.Refresh();
        }