public void print_account_chart(Acc_list account, int c = 0, object ths = null) { MicroAccountsEntities1 accs = new MicroAccountsEntities1(); int count = c; acc_list = new Acc_list(); if (account != null) { if (account.id != 0) { } if (account.children_ledgers.Count() > 0) { count++; // Store keys in a List List <int> list = new List <int>(account.children_ledgers.Keys); // Loop through list foreach (int k in list) { dm = new DummyList(); dm.ledger = account.children_ledgers[k].name; dm.opBal = toCurr.toCurrenc(account.children_ledgers[k].op_total_dc, account.children_ledgers[k].op_total); dm.drAmt = toCurr.toCurrenc("D", account.children_ledgers[k].dr_total); dm.crAmt = toCurr.toCurrenc("C", account.children_ledgers[k].dr_total); if (account.children_ledgers[k].cl_total_dc == "D") { dm.clBal = toCurr.toCurrenc("D", account.children_ledgers[k].dr_total); } else { dm.clBal = toCurr.toCurrenc("C", account.children_ledgers[k].dr_total); } dmList.Add(dm); } count--; } foreach (Acc_list acc in account.children_groups) { count++; print_account_chart(acc, count, this); count--; } //PlaceHolder3.Controls.Add(new Literal { Text = html.ToString() }); } }
public void comm() { for (int i = 0; i <= cm.Length - 1; i++) { cm[i] = new Acc_list(); cm[i].name = i.ToString(); cm[i].ledger = (i + 1).ToString(); } }
private void trailBal() { try { tbl_AccGroup grp = new tbl_AccGroup(); tbl_AccLedger ledg = new tbl_AccLedger(); acc_list = new Acc_list(); acc_list.group = grp.ToString(); acc_list.ledger = ledg.ToString(); acc_list.only_opening = false; acc_list.start_date = null; acc_list.end_date = null; acc_list.affects_gross = -1; acc_list.start(0); decimal dr = acc_list.dr_total; decimal cr = acc_list.cr_total; print_account_chart(acc_list, -1, this); ReportDataSource datasource = new ReportDataSource("DataSet1", dmList); this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(datasource); dmList = new List <DummyList>(); dm = new DummyList(); dm.date = DateTime.Now.Date.ToString("dd-MM-yyyy"); dm.TotaldrAmt = toCurr.toCurrenc("D", dr); dm.TotalcrAmt = toCurr.toCurrenc("D", dr); dmList.Add(dm); ReportDataSource datasource1 = new ReportDataSource("DataSet2", dmList); this.reportViewer1.LocalReport.DataSources.Add(datasource1); } catch (Exception x) { } }
public void add_sub_ledgers() { acc = new MicroAccountsEntities1(); var child_ledger_q = (from c in acc.tbl_AccLedger where c.groupId == this.g_idd select c).ToList(); counter = 0; foreach (tbl_AccLedger ledg in child_ledger_q) { c[counter] = new Acc_list(); c[counter].id = Convert.ToInt32(ledg.Id); c[counter].name = ledg.ledgerName; c[counter].l_group_id = Convert.ToInt32(ledg.groupId); c[counter].l_type = ledg.type; c[counter].l_notes = ledg.notes; //this.children_ledgers[counter] = new Acc_list(); children_ledgers.Add(counter, c[counter]); //this.children_ledgers[counter].id = Convert.ToInt32(ledg.Id); //this.children_ledgers[counter].name = ledg.name; //this.children_ledgers[counter].l_group_id = Convert.ToInt32(ledg.group_id); //this.children_ledgers[counter].l_type = ledg.type; //this.children_ledgers[counter].l_reconciliation = ledg.reconciliation; //this.children_ledgers[counter].l_notes = ledg.notes; /* If start date is specified dont use the opening balance since its not applicable */ if (start_date == null || start_date == "") { this.c[counter].op_total = Convert.ToDecimal(ledg.opBalance); this.c[counter].op_total_dc = ledg.opBalanceDC; } else { c[counter].op_total = Convert.ToDecimal(0.00); c[counter].op_total_dc = ledg.opBalanceDC; } /* Calculating current group opening balance total */ string[] temp3 = Calculate_withdc(this.op_total, this.op_total_dc, Convert.ToDecimal(c[counter].op_total), (c[counter].op_total_dc).ToString()); this.op_total = Convert.ToDecimal(temp3[0]); this.op_total_dc = temp3[1]; if (only_opening == true) { c[counter].dr_total = 0; c[counter].cr_total = 0; c[counter].cl_total = c[counter].op_total; c[counter].cl_total_dc = c[counter].op_total_dc; } else { cl_balance = new closing_balance(); string[] cl = cl_balance.closing_balances(Convert.ToInt32(ledg.Id), start_date, end_date); c[counter].dr_total = Convert.ToDecimal(cl[2]); c[counter].cr_total = Convert.ToDecimal(cl[3]); c[counter].cl_total = Convert.ToDecimal(cl[1]); c[counter].cl_total_dc = cl[0]; } /* Calculating closing balance total for all the child groups*/ string[] temp4 = Calculate_withdc(cl_total, cl_total_dc, Convert.ToDecimal(c[counter].cl_total), (c[counter].cl_total_dc).ToString()); cl_total = Convert.ToDecimal(temp4[0]); cl_total_dc = temp4[1]; /* Calculate Dr and Cr total */ this.dr_total = this.dr_total + c[counter].dr_total; this.cr_total = this.cr_total + c[counter].cr_total; // children_ledgers.Add(children_ledgers[counter]); counter++; } }
public void add_sub_groups() { acc = new MicroAccountsEntities1(); if (this.id == 0) { if (this.affects_gross == 0) { child_group_q = (from c in acc.tbl_AccGroup where c.parentId == 0 && c.affects_gross == 0 select c).ToList(); } if (this.affects_gross == 1) { child_group_q = (from c in acc.tbl_AccGroup where c.parentId == 0 && c.affects_gross == 1 select c).ToList(); } this.affects_gross = -1; child_group_q = (from c in acc.tbl_AccGroup where c.parentId == 0 select c).ToList(); } else { if (this.affects_gross == 0) { child_group_q = (from c in acc.tbl_AccGroup where c.parentId == this.id && c.affects_gross == 0 select c).ToList(); } else if (this.affects_gross == 1) { child_group_q = (from c in acc.tbl_AccGroup where c.parentId == this.id && c.affects_gross == 1 select c).ToList(); } else { this.affects_gross = -1; child_group_q = (from c in acc.tbl_AccGroup where c.parentId == this.id select c).ToList(); } } counter = 0; // this.children_groups = new Acc_list[child_group_q.Count]; foreach (tbl_AccGroup grp in child_group_q) { children_groups[counter] = new Acc_list(); /* Create new AccountList object */ // children_groups[counter] = new Acc_list(); /* Initial setup */ this.children_groups[counter].group = acc.tbl_AccGroup; this.children_groups[counter].ledger = acc.tbl_AccLedger; this.children_groups[counter].only_opening = this.only_opening; this.children_groups[counter].start_date = this.start_date; this.children_groups[counter].end_date = this.end_date; this.children_groups[counter].affects_gross = -1; /* No longer needed in sub groups */ this.children_groups[counter].start(Convert.ToInt32(grp.id)); /* Calculating opening balance total for all the child groups*/ string[] temp = Calculate_withdc(this.op_total, this.op_total_dc, Convert.ToDecimal(this.children_groups[counter].op_total), (this.children_groups[counter].op_total_dc).ToString()); this.op_total = Convert.ToDecimal(temp[0]); this.op_total_dc = temp[1]; /* Calculating closing balance total for all the child groups */ string[] temp2 = Calculate_withdc(this.cl_total, this.cl_total_dc, Convert.ToDecimal(this.children_groups[counter].cl_total), (this.children_groups[counter].cl_total_dc).ToString()); this.cl_total = Convert.ToDecimal(temp2[0]); this.cl_total_dc = temp2[1]; /* Calculate Dr and Cr total */ this.dr_total = this.dr_total + this.children_groups[counter].dr_total; this.cr_total = this.cr_total + this.children_groups[counter].cr_total; counter++; } }
private void BalanceSheetData() { tbl_AccGroup grp = new tbl_AccGroup(); tbl_AccLedger ledg = new tbl_AccLedger(); acc = new MicroAccountsEntities1(); var acc_group_id = (from c in acc.tbl_AccGroup where c.groupName == "Incomes" select c.id).FirstOrDefault(); assets = new Acc_list(); //Income income = new Acc_list(); income.group = grp.ToString(); income.ledger = ledg.ToString(); income.only_opening = only_opening; // income.start_date = txtStartDate.Text; //income.end_date = txtEndDate.Text; income.affects_gross = -1; income.start(Convert.ToInt32(acc_group_id)); //Expenses acc = new MicroAccountsEntities1(); acc_group_id = (from c in acc.tbl_AccGroup where c.groupName == "Expenses" select c.id).FirstOrDefault(); assets = new Acc_list(); expense = new Acc_list(); expense.group = grp.ToString(); expense.ledger = ledg.ToString(); expense.only_opening = only_opening; // expense.start_date = txtStartDate.Text; // expense.end_date = txtEndDate.Text; expense.affects_gross = -1; expense.start(Convert.ToInt32(acc_group_id)); if (income.cl_total_dc == "C") { income_total = income.cl_total; } else { income_total = Convert.ToDecimal(income.cl_total); } if (expense.cl_total_dc == "D") { expense_total = expense.cl_total; } else { expense_total = Convert.ToDecimal(expense.cl_total); } pandl = income_total - expense_total; op_diff = new string[] { }; op_diff = opening_diff(); if (Convert.ToDecimal(op_diff[1]) == 0) { is_diff = false; } else { is_diff = true; } //------------------------------------------------------------------------ ListViewGroup Assets = new ListViewGroup("Assets", HorizontalAlignment.Left); acc = new MicroAccountsEntities1(); acc_group_id = (from c in acc.tbl_AccGroup where c.groupName == "Assets" select c.id).FirstOrDefault(); assets = new Acc_list(); assets.group = grp.ToString(); assets.ledger = ledg.ToString(); assets.only_opening = only_opening; //assets.start_date = txtStartDate.Text; // assets.end_date = txtEndDate.Text; assets.affects_gross = -1; assets.start(Convert.ToInt32(acc_group_id)); Account_st_short(assets, -1, "D", this, 1); // dataGridView2.DataSource = dmList; labels = new Label[dmList.Count + 1]; int k = 35; // create array elements in a loop for (int i = 0; i < dmList.Count; i++) { Font FNT = new Font("Century Gothic", 10.0f, FontStyle.Bold); labels[i] = new Label(); labels[i].Top = k * (i + 1); labels[i].Left = 546; labels[i].Font = FNT; labels[i].Size = new Size(200, 19); if (dmList[i].ledger == "1") { labels[i].Text = " " + dmList[i].group.ToString(); labels[i].ForeColor = Color.Blue; } else { labels[i].ForeColor = Color.Black; labels[i].Text = dmList[i].group.ToString(); } assetsLabelTop = k * (i + 1); } this.Controls.AddRange(labels); labels = new Label[dmList.Count + 1]; k = 36; for (int i = 0; i < dmList.Count; i++) { Font FNT = new Font("Century Gothic", 10.0f, FontStyle.Bold); labels[i] = new Label(); labels[i].Top = k * (i + 1); labels[i].Left = 800; labels[i].Font = FNT; labels[i].Size = new Size(200, 19); labels[i].ForeColor = Color.Black; labels[i].Text = dmList[i].amt.ToString(); } this.Controls.AddRange(labels); dmList = new List <DummyList>(); ListViewGroup LiabilitiesandOwnersEquity = new ListViewGroup("Liabilities and Owners Equity", HorizontalAlignment.Left); acc = new MicroAccountsEntities1(); acc_group_id = (from c in acc.tbl_AccGroup where c.groupName == "Liabilities and Owners Equity" select c.id).FirstOrDefault(); liabilities = new Acc_list(); liabilities.group = grp.ToString(); liabilities.ledger = ledg.ToString(); liabilities.only_opening = only_opening; //liabilities.start_date = txtStartDate.Text; //liabilities.end_date = txtEndDate.Text; liabilities.affects_gross = -1; liabilities.start(Convert.ToInt32(acc_group_id)); Account_st_short(liabilities, -1, "C", this, 2); k = 35; labels = new Label[dmList.Count + 1]; // create array elements in a loop for (int i = 0; i < dmList.Count; i++) { Font FNT = new Font("Century Gothic", 10.0f, FontStyle.Bold); labels[i] = new Label(); labels[i].Top = k * (i + 1); labels[i].Left = 43; labels[i].Font = FNT; if (dmList[i].ledger == "1") { labels[i].Text = " " + dmList[i].group.ToString(); labels[i].ForeColor = Color.Blue; labels[i].Size = new Size(200, 19); } else { labels[i].ForeColor = Color.Black; labels[i].Text = dmList[i].group.ToString(); labels[i].Size = new Size(200, 19); } libLabelTop = k * (i + 1); } this.Controls.AddRange(labels); k = 36; labels = new Label[dmList.Count + 1]; for (int i = 0; i < dmList.Count; i++) { FNT = new Font("Century Gothic", 10.0f, FontStyle.Bold); labels[i] = new Label(); labels[i].Top = k * (i + 1); labels[i].Left = 293; labels[i].Font = FNT; labels[i].Size = new Size(200, 19); labels[i].ForeColor = Color.Black; labels[i].Text = dmList[i].amt.ToString(); } this.Controls.AddRange(labels); if (liabilities.cl_total_dc == "C") { liabilities_total = liabilities.cl_total; } else { liabilities_total = Convert.ToDecimal(liabilities.cl_total * -1); } if (assets.cl_total_dc == "D") { assets_total = assets.cl_total; } else { assets_total = Convert.ToDecimal(assets.cl_total * -1); } /**** Final balancesheet total ****/ final_liabilities_total = liabilities_total; final_assets_total = assets_total; /* If net profit add to liabilities, if net loss add to assets */ if (pandl >= 0) { final_liabilities_total = final_liabilities_total + pandl; } else { positive_pandl = pandl * -1; final_assets_total = final_assets_total + positive_pandl; } /** * If difference in opening balance is Dr then subtract from * assets else subtract from liabilities */ if (is_diff) { if (op_diff[0] == "D") { final_assets_total = Convert.ToDecimal(final_assets_total + Convert.ToDecimal(op_diff[1])); } else { final_liabilities_total = Convert.ToDecimal(final_liabilities_total + Convert.ToDecimal(op_diff[1])); } } panel4.Visible = true; panel4.Top = assetsLabelTop + 35; /* Difference in opening balance */ /* Total */ dmList = new List <DummyList>(); DummyList dm = new DummyList(); if (assets_total >= 0) { Label lb = new Label(); this.Controls.Add(lb); lb.Text = "Total Assets"; lb.Top = assetsLabelTop + 50; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", assets_total); lb.Top = assetsLabelTop + 50; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total Assets"; lb.Top = assetsLabelTop + 50; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); lb.ForeColor = Color.Red; lb = new Label(); this.Controls.Add(lb); lb.Text = "(Expecting positive Dr Balance)"; lb.Top = assetsLabelTop + 65; lb.Left = 549; Font FNTs = new Font("Century Gothic", 8.0f, FontStyle.Bold); lb.Font = FNTs; lb.Size = new Size(250, 19); lb.ForeColor = Color.Red; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", assets_total); lb.Top = assetsLabelTop + 50; lb.Left = 800; lb.Font = FNT; lb.ForeColor = Color.Red; lb.Size = new Size(200, 19); } dmList.Add(dm); dm = new DummyList(); html.Append("<tr style='font-weight:bold'>"); if (pandl >= 0) { lb = new Label(); this.Controls.Add(lb); lb.Text = ""; lb.Top = assetsLabelTop + 100; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = ""; lb.Top = assetsLabelTop + 100; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = "Profit & Loss Account (Net Loss)"; lb.Top = assetsLabelTop + 100; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(250, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", positive_pandl); lb.Top = assetsLabelTop + 100; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } if (is_diff) { /* If diff in opening balance is Dr */ if (op_diff[0] == "D") { lb = new Label(); this.Controls.Add(lb); lb.Text = "Diff in O/P Balance"; lb.Top = assetsLabelTop + 130; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", Convert.ToDecimal(op_diff[1])); lb.Top = assetsLabelTop + 130; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = ""; lb.Top = assetsLabelTop + 130; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = ""; lb.Top = assetsLabelTop + 130; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } } if (final_liabilities_total == final_assets_total) { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total"; lb.Top = assetsLabelTop + 150; lb.Left = 549; lb.Font = FNT; lb.Size = new Size(200, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", Convert.ToDecimal(final_assets_total)); lb.Top = assetsLabelTop + 150; lb.Left = 800; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total"; lb.Top = assetsLabelTop + 150; lb.Left = 549; lb.Font = FNT; lb.ForeColor = Color.Red; positive_pandl = pandl * -1; lb.Size = new Size(200, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", Convert.ToDecimal(final_assets_total)); lb.Top = assetsLabelTop + 150; lb.Left = 800; lb.Font = FNT; lb.ForeColor = Color.Red; lb.Size = new Size(200, 19); } //Liablities bottom total panel6.Visible = true; panel6.Top = libLabelTop + 35; if (liabilities_total >= 0) { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total Liability and Owners Equity"; lb.Size = new Size(200, 19); lb.Top = libLabelTop + 50; lb.Left = 42; lb.Font = FNT; lb = new Label(); this.Controls.Add(lb); lb.Text = (toCurr.toCurrenc("C", liabilities_total)); lb.Top = libLabelTop + 55; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total Liability and Owners Equity"; lb.Top = libLabelTop + 50; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(200, 19); lb.ForeColor = Color.Red; lb = new Label(); this.Controls.Add(lb); lb.Text = (toCurr.toCurrenc("C", liabilities_total)); lb.Top = libLabelTop + 55; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(200, 19); lb.ForeColor = Color.Red; lb = new Label(); this.Controls.Add(lb); lb.Text = "(Expecting positive Cr Balance)"; lb.Top = libLabelTop + 70; lb.Left = 42; Font FNTss = new Font("Century Gothic", 8.0f, FontStyle.Bold); lb.Font = FNTss; lb.Size = new Size(250, 19); lb.ForeColor = Color.Red; } if (pandl >= 0) { lb = new Label(); this.Controls.Add(lb); lb.Text = "Profit & Loss Account (Net Loss)"; lb.Top = libLabelTop + 100; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(250, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", pandl); lb.Top = libLabelTop + 100; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(250, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = " "; lb.Top = libLabelTop + 100; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(250, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = " "; lb.Top = libLabelTop + 100; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(250, 19); } if (is_diff) { html.Append("<tr style='font-weight:bold;color:red'>"); /* If diff in opening balance is Cr */ if (op_diff[0] == "C") { lb = new Label(); this.Controls.Add(lb); lb.Text = "Diff in O/P Balance"; lb.Top = libLabelTop + 130; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(250, 19); lb.ForeColor = Color.Red; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", Convert.ToDecimal(op_diff[1])); lb.Top = libLabelTop + 130; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(250, 19); lb.ForeColor = Color.Red; } else { lb = new Label(); this.Controls.Add(lb); lb.Text = " "; lb.Top = libLabelTop + 130; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(250, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = " "; lb.Top = libLabelTop + 130; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(250, 19); } } if (final_liabilities_total == final_assets_total) { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total"; lb.Top = libLabelTop + 150; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(200, 19); positive_pandl = pandl * -1; lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("c", Convert.ToDecimal(final_assets_total)); lb.Top = libLabelTop + 150; lb.Left = 293; lb.Font = FNT; lb.Size = new Size(200, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = "Total"; lb.Top = libLabelTop + 150; lb.Left = 42; lb.Font = FNT; lb.ForeColor = Color.Red; positive_pandl = pandl * -1; lb.Size = new Size(200, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("c", Convert.ToDecimal(final_assets_total)); lb.Top = libLabelTop + 150; lb.Left = 293; lb.Font = FNT; lb.ForeColor = Color.Red; lb.Size = new Size(200, 19); } }
public void Account_st_short(Acc_list account, int c = 0, string dc_type = "", object ths = null, int lisstType = 0) { int count = c; acc_list = new Acc_list(); ListViewGroup grp; DummyList dm = new DummyList(); if (account != null) { if (account.id > 4) { // grp = new ListViewGroup(account.name, HorizontalAlignment.Left); //if(lisstType==1) // { // listBox1.Items.Add(account.name); // } //else if(lisstType==2) // { // listBox2.Items.Add(account.name); // } //Font FNT = new Font("Century Gothic", 11.0f, FontStyle.Bold); //this.Font = FNT; //this.ForeColor = Color.Black; dm = new DummyList(); dm.group = account.name; // dm.amt = toCurr.toCurrenc(account.cl_total_dc, Convert.ToDecimal(account.cl_total)) ; dm.amt = ""; dmList.Add(dm); } foreach (Acc_list acc in account.children_groups) { count++; Account_st_short(acc, count, dc_type, this, lisstType); count--; } if (account.children_ledgers.Count() > 0) { count++; List <int> list = new List <int>(account.children_ledgers.Keys); // Loop through list foreach (int k in list) { // listView1.Items.Add(new ListViewItem(account.children_ledgers[k].name, account.name)); //listBox1.Items.Add(account.children_ledgers[k].name + " -- " + toCurr.toCurrenc(account.children_ledgers[k].cl_total_dc, account.children_ledgers[k].cl_total)); ////html.Append(toCurr.toCurrenc(account.children_ledgers[k].cl_total_dc, account.children_ledgers[k].cl_total)); //// listView1.Groups.Add(grp); //if (lisstType == 1) //{ // listBox1.Items.Add(account.children_ledgers[k].name + " -- " + toCurr.toCurrenc(account.children_ledgers[k].cl_total_dc, account.children_ledgers[k].cl_total)); //} //else if (lisstType == 2) //{ // listBox2.Items.Add(account.children_ledgers[k].name + " -- " + toCurr.toCurrenc(account.children_ledgers[k].cl_total_dc, account.children_ledgers[k].cl_total)); //} //Font FNTs = new Font("Century Gothic",11.0f); //this.Font = FNTs; //this.ForeColor = Color.Blue; dm = new DummyList(); dm.group = "(" + account.children_ledgers[k].name + ")"; dm.amt = toCurr.toCurrenc(account.children_ledgers[k].cl_total_dc, account.children_ledgers[k].cl_total); dm.ledger = "1"; dmList.Add(dm); } count--; } } }
private void TrailBalance_Load(object sender, EventArgs e) { try { tbl_AccGroup grp = new tbl_AccGroup(); tbl_AccLedger ledg = new tbl_AccLedger(); acc_list = new Acc_list(); acc_list.group = grp.ToString(); acc_list.ledger = ledg.ToString(); acc_list.only_opening = false; acc_list.start_date = null; acc_list.end_date = null; acc_list.affects_gross = -1; acc_list.start(0); decimal dr = acc_list.dr_total; decimal cr = acc_list.cr_total; print_account_chart(acc_list, -1, this); panel2.Top = top + 10; if (dr == cr) { Label lb2 = new Label(); this.Controls.Add(lb2); lb2.Text = "Total"; //lb.Top = assetsLabelTop + 50; lb2.Top = top + 25; lb2.Left = 42; lb2.Font = FNT; lb2.ForeColor = Color.Green; lb2.Size = new Size(150, 19); Label lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", dr); //lb.Top = assetsLabelTop + 50; lb.Top = top + 25; lb.Left = 483; lb.Font = FNT; lb.ForeColor = Color.Green; lb.Size = new Size(150, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", cr); //lb.Top = assetsLabelTop + 50; lb.Top = top + 25; lb.Left = 651; lb.Font = FNT; lb.ForeColor = Color.Green; lb.Size = new Size(150, 19); } else { Label lb1 = new Label(); this.Controls.Add(lb1); lb1.Text = "Total"; //lb.Top = assetsLabelTop + 50; lb1.Top = top + 25; lb1.Left = 42; lb1.Font = FNT; lb1.ForeColor = Color.Red; lb1.Size = new Size(150, 19); Label lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", dr); //lb.Top = assetsLabelTop + 50; lb.Top = top + 25; lb.Left = 483; lb.Font = FNT; lb.ForeColor = Color.Red; lb.Size = new Size(150, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", cr); //lb.Top = assetsLabelTop + 50; lb.Top = top + 25; lb.Left = 651; lb.Font = FNT; lb.ForeColor = Color.Red; lb.Size = new Size(150, 19); } } catch (Exception x) { } }
public void print_account_chart(Acc_list account, int c = 0, object ths = null) { MicroAccountsEntities1 accs = new MicroAccountsEntities1(); int count = c; acc_list = new Acc_list(); DummyList dm = new DummyList(); //StringBuilder html = new StringBuilder(); if (account != null) { if (account.id != 0) { //if (account.g_parent_id == 0) //{ // // html.Append("<tr class='table table-bordered table-striped'>"); // html.Append("<tr style='color:brown;background-color:#F3F3F3'>"); //} //else //{ // // html.Append("<tr class='tr-group'>"); // html.Append("<tr>"); //} ////html.Append("<td class='td-group'>"); //html.Append("<td>"); //html.Append(print_space(count)); //html.Append("<b >" + account.name + "</b>"); //html.Append("</td>"); //html.Append("<td><b>Group<b></td>"); //html.Append("<td><b>"); html.Append(toCurr.toCurrenc(account.op_total_dc, account.op_total)); html.Append("</b></td>"); //html.Append("<td><b>"); html.Append(toCurr.toCurrenc("D", account.dr_total)); html.Append("</b></td>"); //html.Append("<td><b>"); html.Append(toCurr.toCurrenc("C", account.cr_total)); html.Append("</b></td>"); //if (account.cl_total_dc == "D") //{ // html.Append("<td><b>"); html.Append(toCurr.toCurrenc("D", account.cl_total)); html.Append("</b></td>"); //} //else //{ // html.Append("<td><b>"); html.Append(toCurr.toCurrenc("C", account.cl_total)); html.Append("</b></td>"); //} //html.Append("</tr>"); } if (account.children_ledgers.Count() > 0) { count++; // Store keys in a List List <int> list = new List <int>(account.children_ledgers.Keys); // Loop through list foreach (int k in list) { //html.Append(account.children_ledgers[k].name); Label lb = new Label(); this.Controls.Add(lb); lb.Text = account.children_ledgers[k].name; //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 42; lb.Font = FNT; lb.Size = new Size(200, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc(account.children_ledgers[k].op_total_dc, account.children_ledgers[k].op_total); //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 292; lb.Font = FNT; lb.Size = new Size(150, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", account.children_ledgers[k].dr_total); //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 483; lb.Font = FNT; lb.Size = new Size(150, 19); lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", account.children_ledgers[k].dr_total); //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 651; lb.Font = FNT; lb.Size = new Size(150, 19); //html.Append("<a href=''>" + account.children_ledgers[k].name + " </a> "); //html.Append("</td>"); //html.Append("<td>Ledger</td>"); //html.Append("<td>"); //html.Append(toCurr.toCurrenc(account.children_ledgers[k].op_total_dc, account.children_ledgers[k].op_total)); //html.Append("</td>"); //html.Append("<td>"); //html.Append(toCurr.toCurrenc("D", account.children_ledgers[k].dr_total)); //html.Append("</td>"); //html.Append("<td>"); //html.Append(toCurr.toCurrenc("C", account.children_ledgers[k].cr_total)); //html.Append("</td>"); if (account.children_ledgers[k].cl_total_dc == "D") { lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("D", account.children_ledgers[k].dr_total); //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 806; lb.Font = FNT; lb.Size = new Size(150, 19); } else { lb = new Label(); this.Controls.Add(lb); lb.Text = toCurr.toCurrenc("C", account.children_ledgers[k].dr_total); //lb.Top = assetsLabelTop + 50; lb.Top = top; lb.Left = 806; lb.Font = FNT; lb.Size = new Size(150, 19); } //html.Append("</tr>"); top = top + 25; } count--; } foreach (Acc_list acc in account.children_groups) { count++; print_account_chart(acc, count, this); count--; } //PlaceHolder3.Controls.Add(new Literal { Text = html.ToString() }); } }