コード例 #1
0
        public dynamic DisplayVoucherData()
        {
            using (AccountingEntity context = new AccountingEntity())
            {
                var results = from v in context.Vouchers
                              join em in context.Employees
                              on v.AuthenticationBy equals em.Emp_ID
                              join accDebit in context.Accounts
                              on v.Debit equals accDebit.Code
                              join accCredit in context.Accounts
                              on v.Credit equals accCredit.Code

                              select new
                {
                    voucherNo      = v.VNo,
                    Debit          = accDebit.Name,
                    Amount         = v.Amount,
                    Credit         = accCredit.Name,
                    Date           = v.VDate,
                    Narration      = v.Narration,
                    Authentication = em.FName
                                     //State = r.StateNavigationProperty.StateLabel, //If FK
                                     //State = _context.State.First(state => state.StateId == r.StateId), //If Not FK
                                     //HostAddress = r.ServerReference.Value.HostAddress,
                                     //TimeStamp = r.TimeStamp
                };
                var resultToList = results.ToList();
                return(resultToList);
            }
        }
コード例 #2
0
        public void Run(IHR1Context db, AccountingEntity accountingEntity)
        {
            var amtInput = new JournalTemplateInput()
            {
                AppTenantID   = accountingEntity.AppTenantID,
                Name          = "Salary",
                UserInputType = db.UserInputTypes.First(x => x.Code == "CURRENCY")
            };

            var template = new JournalTemplate();

            template.AppTenantID = accountingEntity.AppTenantID;
            template.JournalType = db.JournalTypes.First(x => x.Code == "PAYSTUB");
            template.Name        = "Salary";
            template.OriginKey   = "EmploymentContract";
            template.UserInputs.Add(amtInput);


            var templateTxn = new JournalTemplateTxn();

            templateTxn.AppTenantID    = accountingEntity.AppTenantID;
            templateTxn.AmountInput    = amtInput;
            templateTxn.Description    = "Salary";
            templateTxn.JournalTxnType = template.JournalType.JournalTxnTypes.First(x => x.IsCode == "AMT");

            template.JournalTemplateTxns.Add(templateTxn);

            accountingEntity.JournalTemplates.Add(template);
        }
コード例 #3
0
        public static DataTable TransactionTable(int x)
        {
            int code = x;

            using (AccountingEntity c = new AccountingEntity())

            {
                List <Account> usepurposes = c.Accounts.ToList();
                Account        account     = new Account();

                DataTable dt = new DataTable();
                dt.Columns.Add("id");
                dt.Columns.Add("name");
                var query = from ac in c.Accounts
                            where ac.Code == code
                            select ac.Type;
                int type = query.FirstOrDefault();


                //var queryToList = query.ToList();
                //int type= Convert.ToInt32( query);

                foreach (Account usepurpose in usepurposes)
                {
                    if (usepurpose.Type != type)
                    {
                        dt.Rows.Add(usepurpose.Code, usepurpose.Name);
                    }
                }
                return(dt);
            }
        }
コード例 #4
0
 public int returnVoucherNo()
 {
     using (AccountingEntity context = new AccountingEntity())
     {
         int id = context.Vouchers.Max(r => r.VNo);
         return(id + 1);
     }
 }
コード例 #5
0
        public void AccountDataEntry()
        {
            using (AccountingEntity context = new AccountingEntity())
            {
                int i = 4;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "BANK ACCOUNT", Type = 3
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "ADVERTISEMENT AND PUBLICITY EXP", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "GENERAL EXPENSES", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "REPAIR & MAINTENANCE EXPENSES ACCOUNT", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "MISCELLANEOUS EXPENSES", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "SALARY ACCOUNT", Type = 2
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "WAGES ACCOUNT", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "INCOME TAX ACCOUNT", Type = 4
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "RENT ACCOUNT", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "PURCHASE ACCOUNT", Type = 1
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "LOANS TO STAFF", Type = 4
                });
                i = i + 2;
                context.Accounts.Add(new Account {
                    Code = 110000 + i, Name = "FURNITURE ACCOUNT", Type = 3
                });



                context.SaveChanges();
            }
        }
コード例 #6
0
 public void UpdateIntoVoucher(int VoucherNo, int paidBy, int transactionType, int amount, string narration, DateTime date, string employeeID)
 {
     using (AccountingEntity context = new AccountingEntity())
     {
         Voucher voucher = context.Vouchers.FirstOrDefault(r => r.VNo == VoucherNo);
         voucher.Debit            = transactionType;
         voucher.Credit           = paidBy;
         voucher.Amount           = amount;
         voucher.Narration        = narration;
         voucher.VDate            = DateTime.Now;
         voucher.AuthenticationBy = employeeID;
         context.SaveChanges();
     }
 }
コード例 #7
0
        public async Task <IHttpActionResult> Register(RegisterRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            //using (TransactionScope scope = new TransactionScope())
            {
                IHR1Context db = AppCore.IoC.Container.Resolve <IHR1Context>();

                try
                {
                    AppTenant tenant = new AppTenant();
                    tenant.Name = model.CompanyName;
                    var user = new AppUser()
                    {
                        UserName = model.Email, Email = model.Email, AppTenant = tenant
                    };
                    IdentityResult result = await UserManager.CreateAsync(user, model.Password);

                    if (!result.Succeeded)
                    {
                        //scope.Dispose();
                        return(GetErrorResult(result));
                    }

                    var tenantParty = new Party()
                    {
                        AppTenantID = tenant.ID, Name = model.CompanyName, PartyType = "C"
                    };
                    var tentantEntity = new AccountingEntity()
                    {
                        AppTenantID = tenant.ID, Party = tenantParty
                    };
                    db.AccountingEntities.Add(tentantEntity);
                    await db.SaveChangesAsync();

                    //scope.Complete();
                }
                catch (Exception ex)
                {
                    //scope.Dispose();
                    throw ex;
                }
            }

            return(Ok());
        }
コード例 #8
0
        public static DataTable EmployeeTable()
        {
            using (AccountingEntity c = new AccountingEntity())
            {
                List <Employee> usepurposes = c.Employees.ToList();
                DataTable       dt          = new DataTable();
                dt.Columns.Add("Emp_ID");
                dt.Columns.Add("First Name");

                foreach (Employee usepurpose in usepurposes)
                {
                    dt.Rows.Add(usepurpose.Emp_ID, usepurpose.FName);
                }
                return(dt);
            }
        }
コード例 #9
0
 public static DataTable AccountTable()
 {
     using (AccountingEntity c = new AccountingEntity())
     {
         List <Account> usepurposes = c.Accounts.ToList();
         DataTable      dt          = new DataTable();
         dt.Columns.Add("id");
         dt.Columns.Add("name");
         foreach (Account usepurpose in usepurposes)
         {
             // if (usepurpose.Type==4)
             dt.Rows.Add(usepurpose.Code, usepurpose.Name);
         }
         return(dt);
     }
 }
コード例 #10
0
 public void InsertIntoVoucher(int paidBy, int transactionType, int amount, string narration, DateTime date, string employeeID)
 {
     using (AccountingEntity context = new AccountingEntity())
     {
         Voucher voucher = new Voucher
         {
             Debit            = paidBy,
             Credit           = transactionType,
             Amount           = amount,
             Narration        = narration,
             VDate            = date,
             AuthenticationBy = employeeID,
             PreparedBy       = "A001"
         };
         context.Vouchers.Add(voucher);
         //  MessageBox.Show(voucher.AuthenticationBy.ToString());
         context.SaveChanges();
     }
 }
コード例 #11
0
 public void OnChangeAccountingEntity(AccountingEntity entity, UpdateOperations operations)
 {
     InterceptChange(entity, operations);
 }
コード例 #12
0
        public async Task <IHttpActionResult> Register(RegisterRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            //using (TransactionScope scope = new TransactionScope())
            {
                IS1Context db = AppCore.IoC.Container.Resolve <IS1Context>();

                try
                {
                    string roleId = _identityContext.GetRoleIdByCode("CM");

                    AppTenant tenant = new AppTenant();
                    tenant.Name = model.PropertyName;
                    var user = new AppUser()
                    {
                        UserName = model.Email, Email = model.Email
                    };

                    user.AppTenantUsers.Add(new AppTenantUser()
                    {
                        AppRoleID = roleId,
                        AppTenant = tenant
                    });


                    IdentityResult result = await UserManager.CreateAsync(user, model.Password);

                    if (!result.Succeeded)
                    {
                        //scope.Dispose();
                        return(GetErrorResult(result));
                    }


                    var region = (_appContext as IS1Context).Regions.Single(x => x.Code == "BC"); //temp

                    var tenantParty = new Party()
                    {
                        AppTenantID = tenant.ID, Name = model.PropertyName, PartyType = "C"
                    };

                    var tentantEntity = new AccountingEntity()
                    {
                        AppTenantID = tenant.ID,
                        Party       = tenantParty,
                        Region      = region
                    };

                    db.AccountingEntities.Add(tentantEntity);
                    await db.SaveChangesAsync();

                    //scope.Complete();
                }
                catch (Exception ex)
                {
                    //scope.Dispose();
                    throw ex;
                }
            }

            return(Ok());
        }