示例#1
0
 static internal TrialBalanceDto Map(TrialBalance trialBalance)
 {
     return(new TrialBalanceDto {
         Command = trialBalance.Command,
         Columns = trialBalance.DataColumns(),
         Entries = Map(trialBalance.Command, trialBalance.Entries)
     });
 }
        public override global::System.Data.DataSet Clone()
        {
            TrialBalance cln = ((TrialBalance)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
 public void Insert(TrialBalance entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     context.TrialBalances.Add(entity);
     context.SaveChanges();
 }
 public void Update(TrialBalance entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }
        public TrialBalanceDto BuildTrialBalance(TrialBalanceCommand command)
        {
            Assertion.AssertObject(command, "command");

            var trialBalanceEngine = new TrialBalanceEngine(command);

            TrialBalance trialBalance = trialBalanceEngine.BuildTrialBalance();

            return(TrialBalanceMapper.Map(trialBalance));
        }
        public void Delete(TrialBalance entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            TrialBalance tToDelete = GetById(entity.Id);

            context.TrialBalances.Remove(tToDelete);
            context.SaveChanges();
        }
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Partners                        = new Partners(this);
     Selectables                     = new Selectables(this);
     AccountItems                    = new AccountItems(this);
     Tags                            = new Tags(this);
     Sections                        = new Sections(this);
     Invoices                        = new Invoices(this);
     Deals                           = new DealsOperations(this);
     Renews                          = new Renews(this);
     Payments                        = new Payments(this);
     ManualJournals                  = new ManualJournals(this);
     Users                           = new Users(this);
     Companies                       = new Companies(this);
     Items                           = new Items(this);
     Taxes                           = new Taxes(this);
     Walletables                     = new Walletables(this);
     Banks                           = new Banks(this);
     Transfers                       = new Transfers(this);
     WalletTxns                      = new WalletTxnsOperations(this);
     Journals                        = new Journals(this);
     TrialBalance                    = new TrialBalance(this);
     Receipts                        = new Receipts(this);
     ExpenseApplications             = new ExpenseApplications(this);
     ExpenseApplicationLineTemplates = new ExpenseApplicationLineTemplates(this);
     SegmentTags                     = new SegmentTags(this);
     BaseUri                         = new System.Uri("https://api.freee.co.jp/api/1");
     SerializationSettings           = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            TrialBalance ds = new TrialBalance();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                TrialBalance ds = new TrialBalance();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "TrialBalanceDtDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
示例#10
0
 public TrialBalance UpdateTrialBalance(TrialBalance trialBalance)
 {
     return(Channel.UpdateTrialBalance(trialBalance));
 }
示例#11
0
        private async Task InvokeSelectedOption(SelectedOption option)
        {
            switch (option)
            {
            case SelectedOption.Quit:
                Environment.Exit(0);
                break;

            case SelectedOption.GetAllRecords:
                var getAllRecordsQuery = new StubGetAllRecords();
                var records            = await getAllRecordsQuery.QueryAsync();

                records.ToList().ForEach((record) => Console.WriteLine($"{record.EngagementName} [{record.Id}]"));
                break;

            case SelectedOption.GetSpecificRecord:
                Console.Write("Please enter the Guid to get: ");
                Guid recordToGet            = Guid.Parse(Console.ReadLine());
                var  getSpecificRecordQuery = new StubGetSpecificRecord();
                var  specificRecord         = await getSpecificRecordQuery.QueryAsync(recordToGet);

                if (specificRecord == null)
                {
                    Console.WriteLine("NO RECORDS FOUND");
                }
                else
                {
                    Console.WriteLine($"{specificRecord.EngagementName} [{specificRecord.Id}]");
                }
                break;

            case SelectedOption.CreateRecord:
                Console.WriteLine("Please fill out the following details:");
                Console.Write("Engagement Name: ");
                string engagementName = Console.ReadLine();
                Console.Write("Firm Guid: ");
                Guid firmGuid     = Guid.Parse(Console.ReadLine());
                var  trialBalance = new TrialBalance()
                {
                    Id             = Guid.NewGuid(), // TODO: Allow CosmosDB to auto-generate the ID.
                    EngagementName = engagementName,
                    FirmGuid       = firmGuid
                };
                var createRecordCommand = new StubCreateRecord();
                await createRecordCommand.ExecuteAsync(trialBalance);

                break;

            case SelectedOption.UpdateSpecificRecord:
                Console.Write("Specify the trial balance id to modify: ");
                Guid trialBalanceId = Guid.Parse(Console.ReadLine());
                Console.Write("What is the new engagement name? : ");
                string newEngagementName   = Console.ReadLine();
                var    updateRecordCommand = new StubUpdateSpecificRecord();
                await updateRecordCommand.ExecuteAsync(new UpdateSpecificRecordArgs()
                {
                    Id = trialBalanceId, EngagementName = newEngagementName
                });

                break;
            }
        }
示例#12
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();
        }
        public ActionResult Index(DateTime enddate)
        {
            Session["err"] = "Error, Please Check Input Fields";
            Session["msg"] = "";
            int userid = Convert.ToInt32(Session["UserID"].ToString());

            foreach (TrialBalance trialbalanceexist in db.TrialBalances.Where(c => c.UserId == userid).ToList())
            {
                db.TrialBalances.Remove(trialbalanceexist);
            }
            db.SaveChanges();
            Company company = db.Companys.Include(c => c.CurrentCountry).Include(c => c.CurrentCity).Where(c => c.CompanyID == 1).FirstOrDefault();

            TrialBalance trialbalance = new TrialBalance();

            trialbalance.Col1    = "";
            trialbalance.Col2    = "";
            trialbalance.Col3    = "";
            trialbalance.Address = "<b>" + company.Name + "</b><br/>Address: " + company.HouseNo + " " + company.BuildingName + " " + company.Street + " " + company.Area + " " + company.Location + " " + company.CurrentCity.Name + " " + company.CurrentCountry.Name + " " + company.PinCode + "<br/>Email: " + company.Email + " , Mobile: " + company.Mobile;
            trialbalance.EndDate = "For the period of ending : " + Convert.ToDateTime(enddate.ToString()).Day.ToString() + "-" + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToDateTime(enddate.ToString()).Month) + "-" + Convert.ToDateTime(enddate.ToString()).Year;
            trialbalance.UserId  = userid;
            db.TrialBalances.Add(trialbalance);
            db.SaveChanges();

            trialbalance         = new TrialBalance();
            trialbalance.Col1    = "<b>Particulars</b>";
            trialbalance.Col2    = "<b>Credit</b>";
            trialbalance.Col3    = "<b>Debit</b>";
            trialbalance.Address = "<b></b>";
            trialbalance.EndDate = "";
            trialbalance.UserId  = userid;
            db.TrialBalances.Add(trialbalance);
            db.SaveChanges();
            try
            {
                var accountheads = db.AccountHeads.Include(a => a.CurrentAccountGroup).Include(a => a.CurrentAccountGroup.CurrentAccountCategory).OrderByDescending(a => a.AccountHeadID).ToList();
                foreach (var item in accountheads.OrderBy(item => item.CurrentAccountGroup.CurrentAccountCategory.Name).Select(item => item.CurrentAccountGroup.CurrentAccountCategory.AccountCategoryID).Distinct())
                {
                    AccountCategory accountcategory = db.AccountCategorys.Find(item);
                    decimal         creditamt       = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.CurrentAccountGroup.CurrentAccountCategory.AccountCategoryID == item && t.Amount < 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                    decimal         debitamt        = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.CurrentAccountGroup.CurrentAccountCategory.AccountCategoryID == item && t.Amount > 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                    trialbalance         = new TrialBalance();
                    trialbalance.Col1    = "<h3>" + accountcategory.Name + "</h3>";
                    trialbalance.Col2    = "<h3>" + Convert.ToString(Convert.ToDecimal(creditamt).ToString("#,##0.00")).Replace("-", "") + "</h3>";
                    trialbalance.Col3    = "<h3>" + Convert.ToString(Convert.ToDecimal(debitamt).ToString("#,##0.00")).Replace("-", "") + "</h3>";
                    trialbalance.Address = "";
                    trialbalance.EndDate = "";
                    trialbalance.UserId  = userid;
                    db.TrialBalances.Add(trialbalance);
                    db.SaveChanges();

                    foreach (var item2 in accountheads.Where(item2 => item2.CurrentAccountGroup.CurrentAccountCategory.AccountCategoryID == item).OrderBy(item2 => item2.CurrentAccountGroup.Name).Select(item2 => item2.CurrentAccountGroup.AccountGroupID).Distinct())
                    {
                        AccountGroup accountgroup = db.AccountGroups.Find(item2);
                        decimal      creditamt2   = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.CurrentAccountGroup.AccountGroupID == item2 && t.Amount < 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                        decimal      debitamt2    = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.CurrentAccountGroup.AccountGroupID == item2 && t.Amount > 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                        trialbalance         = new TrialBalance();
                        trialbalance.Col1    = "<h4><span style='color:#919191'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + accountgroup.Name + "</span></h4>";
                        trialbalance.Col2    = "<h4><span style='color:#919191'>" + Convert.ToString(Convert.ToDecimal(creditamt2).ToString("#,##0.00")).Replace("-", "") + "</span></h4>";
                        trialbalance.Col3    = "<h4><span style='color:#919191'>" + Convert.ToString(Convert.ToDecimal(creditamt2).ToString("#,##0.00")).Replace("-", "") + "</span></h4>";
                        trialbalance.Address = "";
                        trialbalance.EndDate = "";
                        trialbalance.UserId  = userid;
                        db.TrialBalances.Add(trialbalance);
                        db.SaveChanges();

                        foreach (var item3 in accountheads.Where(item3 => item3.CurrentAccountGroup.AccountGroupID == item2).OrderBy(item3 => item3.CurrentAccountGroup.Name).Select(item3 => item3.AccountHeadID).Distinct())
                        {
                            AccountHead accounthead = db.AccountHeads.Find(item3);
                            decimal     creditamt3  = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.AccountHeadID == item3 && t.Amount < 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                            decimal     debitamt3   = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.CurrentAccountHead.AccountHeadID == item3 && t.Amount > 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                            trialbalance         = new TrialBalance();
                            trialbalance.Col1    = "<small><span style='color:#C0C0C0'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + accounthead.Name + "</span></small>";
                            trialbalance.Col2    = "<small><span style='color:#C0C0C0'>" + Convert.ToString(Convert.ToDecimal(creditamt3).ToString("#,##0.00")).Replace("-", "") + "</span></small>";
                            trialbalance.Col3    = "<small><span style='color:#C0C0C0'>" + Convert.ToString(Convert.ToDecimal(creditamt3).ToString("#,##0.00")).Replace("-", "") + "</span></small>";
                            trialbalance.Address = "";
                            trialbalance.EndDate = "";
                            trialbalance.UserId  = userid;
                            db.TrialBalances.Add(trialbalance);
                            db.SaveChanges();
                        }
                    }
                }

                decimal creditamt4 = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.Amount < 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                decimal debitamt4  = db.AccountJournalDetails.Include(a => a.CurrentAccountJournal).Where(t => t.CurrentAccountJournal.TransactionDate <= enddate && t.Amount > 0).Select(t => t.Amount).DefaultIfEmpty().Sum();
                trialbalance         = new TrialBalance();
                trialbalance.Col1    = "<b>Grand Total</b>";
                trialbalance.Col2    = "<b>" + Convert.ToString(Convert.ToDecimal(creditamt4).ToString("#,##0.00")).Replace("-", "") + "</b>";
                trialbalance.Col3    = "<b>" + Convert.ToString(Convert.ToDecimal(debitamt4).ToString("#,##0.00")).Replace("-", "") + "</b>";
                trialbalance.Address = "";
                trialbalance.EndDate = "";
                trialbalance.UserId  = userid;
                db.TrialBalances.Add(trialbalance);
                db.SaveChanges();

                Session["err"] = "";
                Session["msg"] = "Generated Successfully";
            }
            catch { }

            ViewBag.Message = Session["msg"];
            ViewBag.Error   = Session["err"];
            Session["err"]  = "";
            Session["msg"]  = "";
            var trialbalancelist = db.TrialBalances.ToList();

            return(View(trialbalancelist));
        }