예제 #1
0
        public ActionResult Edit(List <tempJournalVoucherDetail> journalVoucherDetailList, List <tempJournalVoucher> journalVoucherList, string create)
        {
            Session["err"] = "Error, Please Check Input Fields";
            Session["msg"] = "";
            int journalvoucherid = 0;

            foreach (tempJournalVoucherDetail t in journalVoucherDetailList.ToList())
            {
                journalvoucherid = t.journalvoucherid;
                try
                {
                    JournalVoucherDetail journalvoucherdetail = db.JournalVoucherDetails.Find(t.journalvoucherdetailid);
                    if (journalvoucherdetail == null)
                    {
                        JournalVoucherDetail journalvoucherdetail1 = new JournalVoucherDetail();
                        journalvoucherdetail1.JournalVoucherID = t.journalvoucherid;
                        journalvoucherdetail1.AccountHeadID    = t.accountheadid;
                        journalvoucherdetail1.DebitCreditID    = t.debitcreditid;
                        journalvoucherdetail1.Amount           = decimal.Round(Convert.ToDecimal(t.amount.Replace(",", "")), 2, MidpointRounding.AwayFromZero);
                        journalvoucherdetail1.Remarks          = t.remarks;
                        db.JournalVoucherDetails.Add(journalvoucherdetail1);
                        db.SaveChanges();
                    }
                    else
                    {
                        journalvoucherdetail.JournalVoucherID = t.journalvoucherid;
                        journalvoucherdetail.AccountHeadID    = t.accountheadid;
                        journalvoucherdetail.DebitCreditID    = t.debitcreditid;
                        if (t.debitcreditid == 1)
                        {
                            journalvoucherdetail.Amount = decimal.Round(Convert.ToDecimal(t.amount.Replace(",", "")), 2, MidpointRounding.AwayFromZero);
                        }
                        else
                        {
                            journalvoucherdetail.Amount = decimal.Round(Convert.ToDecimal(t.amount.Replace(",", "")) * -1, 2, MidpointRounding.AwayFromZero);
                        }

                        journalvoucherdetail.Remarks         = t.remarks;
                        db.Entry(journalvoucherdetail).State = EntityState.Modified;
                        db.SaveChanges();
                    }

                    journalvoucherid = t.journalvoucherid;
                }
                catch { }
            }

            try
            {
                var journalvoucherdetailfinal = db.JournalVoucherDetails.Where(b => b.JournalVoucherID == journalvoucherid).OrderBy(b => b.JournalVoucherDetailID).Skip(1).ToList();
                foreach (JournalVoucherDetail cvd in journalvoucherdetailfinal)
                {
                    if (cvd.Amount == 0)
                    {
                        db.JournalVoucherDetails.Remove(cvd);
                        db.SaveChanges();
                    }
                }
            }
            catch {}


            if (create == "1")
            {
                try
                {
                    JournalVoucherDetail journalvoucherdetail1 = new JournalVoucherDetail();
                    journalvoucherdetail1.JournalVoucherID = journalvoucherid;
                    journalvoucherdetail1.AccountHeadID    = 1;
                    journalvoucherdetail1.DebitCreditID    = 1;
                    journalvoucherdetail1.Amount           = 0.00M;
                    journalvoucherdetail1.Remarks          = "";
                    db.JournalVoucherDetails.Add(journalvoucherdetail1);
                    db.SaveChanges();
                }
                catch { }
            }

            decimal debittotalamt  = 0;
            decimal credittotalamt = 0;

            try
            {
                debittotalamt = db.JournalVoucherDetails.Where(u => u.JournalVoucherID == journalvoucherid).Where(u => u.DebitCreditID == 1).Sum(u => (decimal)u.Amount);
            }
            catch { }
            try
            {
                credittotalamt = db.JournalVoucherDetails.Where(u => u.JournalVoucherID == journalvoucherid).Where(u => u.DebitCreditID == 2).Sum(u => (decimal)u.Amount);
            }
            catch { }


            try {
                foreach (tempJournalVoucher bv in journalVoucherList.ToList())
                {
                    JournalVoucher journalvoucherfinal = db.JournalVouchers.Find(bv.journalvoucherid);
                    journalvoucherfinal.VoucherNo         = "JV-" + journalvoucherid.ToString("D" + 6);
                    journalvoucherfinal.VoucherDate       = bv.voucherdate;
                    journalvoucherfinal.Narration         = bv.narration;
                    journalvoucherfinal.DebitTotalAmount  = decimal.Round(Convert.ToDecimal(debittotalamt), 2, MidpointRounding.AwayFromZero);
                    journalvoucherfinal.CreditTotalAmount = decimal.Round(Convert.ToDecimal(credittotalamt), 2, MidpointRounding.AwayFromZero);
                    journalvoucherfinal.DiffTotalAmount   = decimal.Round(Convert.ToDecimal((debittotalamt - Convert.ToDecimal(credittotalamt.ToString().Replace("-", "")))), 2, MidpointRounding.AwayFromZero);
                    db.Entry(journalvoucherfinal).State   = EntityState.Modified;
                    db.SaveChanges();

                    if (create == "0")
                    {
                        journalvoucherfinal.Flag            = true;
                        db.Entry(journalvoucherfinal).State = EntityState.Modified;
                        db.SaveChanges();

                        var accountjournals = db.AccountJournals.Where(a => a.VoucherNo == journalvoucherfinal.VoucherNo).ToList();
                        foreach (AccountJournal accountjournal1 in accountjournals)
                        {
                            var accountjournaldetails = db.AccountJournalDetails.Where(a => a.AccountJournalID == accountjournal1.AccountJournalID).ToList();
                            foreach (AccountJournalDetail accountjournaldetail1 in accountjournaldetails)
                            {
                                db.AccountJournalDetails.Remove(accountjournaldetail1);
                            }
                            db.SaveChanges();
                            db.AccountJournals.Remove(accountjournal1);
                        }
                        db.SaveChanges();

                        AccountJournal accountjournal = new AccountJournal();
                        accountjournal.VoucherNo       = journalvoucherfinal.VoucherNo;
                        accountjournal.VoucherType     = journalvoucherfinal.VoucherNo.Substring(0, 2);
                        accountjournal.TransactionDate = journalvoucherfinal.VoucherDate;
                        accountjournal.BranchID        = int.Parse(Session["BranchID"].ToString());
                        accountjournal.FinancialYearID = int.Parse(Session["FinancialYearID"].ToString());
                        accountjournal.UserID          = Session["UserID"].ToString();
                        accountjournal.Remarks         = "Journal Voucher";
                        db.AccountJournals.Add(accountjournal);
                        db.SaveChanges();

                        var journalvoucherdetail = db.JournalVoucherDetails.Where(d => d.JournalVoucherID == journalvoucherfinal.JournalVoucherID).ToList();

                        foreach (JournalVoucherDetail d in journalvoucherdetail)
                        {
                            AccountJournalDetail accountjournaldetail = new AccountJournalDetail();
                            accountjournaldetail.AccountJournalID = accountjournal.AccountJournalID;
                            accountjournaldetail.AccountHeadID    = d.AccountHeadID;
                            accountjournaldetail.AnalysisHeadID   = 0;
                            if (d.DebitCreditID == 1)
                            {
                                accountjournaldetail.Amount  = d.Amount;
                                accountjournaldetail.Remarks = "Journal Voucher Debit";
                            }
                            else
                            {
                                accountjournaldetail.Amount  = d.Amount * -1;
                                accountjournaldetail.Remarks = "Journal Voucher Credit";
                            }
                            db.AccountJournalDetails.Add(accountjournaldetail);
                            db.SaveChanges();
                        }
                    }

                    Session["msg"] = "Modified Successfully";
                    Session["err"] = "";
                }
            }
            catch {}
            return(Json(Session["err"], JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(List <tempBankVoucherDetail> bankVoucherDetailList, List <tempBankVoucher> bankVoucherList, string create)
        {
            Session["err"] = "Error, Please Check Input Fields";
            Session["msg"] = "";
            int bankvoucherid = 0;

            foreach (tempBankVoucherDetail t in bankVoucherDetailList.ToList())
            {
                bankvoucherid = t.bankvoucherid;
                if (Convert.ToDecimal(t.amount.Replace(",", "")) > 0)
                {
                    try
                    {
                        BankVoucherDetail bankvoucherdetail = db.BankVoucherDetails.Find(t.bankvoucherdetailid);
                        if (bankvoucherdetail == null)
                        {
                            BankVoucherDetail bankvoucherdetail1 = new BankVoucherDetail();
                            bankvoucherdetail1.BankVoucherID = t.bankvoucherid;
                            bankvoucherdetail1.AccountHeadID = t.accountheadid;
                            bankvoucherdetail1.Amount        = decimal.Round(Convert.ToDecimal(t.amount.Replace(",", "")), 2, MidpointRounding.AwayFromZero);
                            bankvoucherdetail1.Remarks       = t.remarks;
                            db.BankVoucherDetails.Add(bankvoucherdetail1);
                            db.SaveChanges();
                        }
                        else
                        {
                            bankvoucherdetail.BankVoucherID   = t.bankvoucherid;
                            bankvoucherdetail.AccountHeadID   = t.accountheadid;
                            bankvoucherdetail.Amount          = decimal.Round(Convert.ToDecimal(t.amount.Replace(",", "")), 2, MidpointRounding.AwayFromZero);
                            bankvoucherdetail.Remarks         = t.remarks;
                            db.Entry(bankvoucherdetail).State = EntityState.Modified;
                            db.SaveChanges();
                        }

                        bankvoucherid = t.bankvoucherid;
                    }
                    catch { }
                }
            }

            try
            {
                var bankvoucherdetailfinal = db.BankVoucherDetails.Where(b => b.BankVoucherID == bankvoucherid).OrderBy(b => b.BankVoucherDetailID).Skip(1).ToList();
                foreach (BankVoucherDetail cvd in bankvoucherdetailfinal)
                {
                    if (cvd.Amount == 0)
                    {
                        db.BankVoucherDetails.Remove(cvd);
                        db.SaveChanges();
                    }
                }
            }
            catch {}

            if (create == "1")
            {
                try
                {
                    BankVoucherDetail bankvoucherdetail1 = new BankVoucherDetail();
                    bankvoucherdetail1.BankVoucherID = bankvoucherid;
                    bankvoucherdetail1.AccountHeadID = 1;
                    bankvoucherdetail1.Amount        = 0.00M;
                    bankvoucherdetail1.Remarks       = "";
                    db.BankVoucherDetails.Add(bankvoucherdetail1);
                    db.SaveChanges();
                }
                catch { }
            }
            decimal totalamt = 0;

            try
            {
                totalamt = db.BankVoucherDetails.Where(u => u.BankVoucherID == bankvoucherid).Sum(u => (decimal)u.Amount);
            }
            catch { }
            try {
                foreach (tempBankVoucher bv in bankVoucherList.ToList())
                {
                    BankVoucher bankvoucherfinal = db.BankVouchers.Find(bv.bankvoucherid);
                    if (bv.vouchertypeid == 1)
                    {
                        bankvoucherfinal.VoucherNo = "CRV-" + bankvoucherid.ToString("D" + 6);
                    }
                    else
                    {
                        bankvoucherfinal.VoucherNo = "CPV-" + bankvoucherid.ToString("D" + 6);
                    }
                    bankvoucherfinal.VoucherTypeID   = bv.vouchertypeid;
                    bankvoucherfinal.EmployeeID      = bv.employeeid;
                    bankvoucherfinal.AccountHeadID   = bv.accountheadid;
                    bankvoucherfinal.VoucherDate     = bv.voucherdate;
                    bankvoucherfinal.ReferenceNo     = bv.referenceno;
                    bankvoucherfinal.ReferenceDate   = bv.referencedate;
                    bankvoucherfinal.Narration       = bv.narration;
                    bankvoucherfinal.TotalAmount     = decimal.Round(Convert.ToDecimal(totalamt.ToString("#.##")), 2, MidpointRounding.AwayFromZero);
                    db.Entry(bankvoucherfinal).State = EntityState.Modified;
                    db.SaveChanges();
                    if (create == "0" && bankvoucherfinal.TotalAmount > 0)
                    {
                        bankvoucherfinal.Flag            = true;
                        db.Entry(bankvoucherfinal).State = EntityState.Modified;
                        db.SaveChanges();

                        var accountjournals = db.AccountJournals.Where(a => a.VoucherNo == bankvoucherfinal.VoucherNo).ToList();
                        foreach (AccountJournal accountjournal1 in accountjournals)
                        {
                            var accountjournaldetails = db.AccountJournalDetails.Where(a => a.AccountJournalID == accountjournal1.AccountJournalID).ToList();
                            foreach (AccountJournalDetail accountjournaldetail1 in accountjournaldetails)
                            {
                                db.AccountJournalDetails.Remove(accountjournaldetail1);
                            }
                            db.SaveChanges();
                            db.AccountJournals.Remove(accountjournal1);
                        }
                        db.SaveChanges();

                        AccountJournal accountjournal = new AccountJournal();
                        accountjournal.VoucherNo       = bankvoucherfinal.VoucherNo;
                        accountjournal.VoucherType     = bankvoucherfinal.VoucherNo.Substring(0, 2);
                        accountjournal.TransactionDate = bankvoucherfinal.VoucherDate;
                        accountjournal.BranchID        = int.Parse(Session["BranchID"].ToString());
                        accountjournal.FinancialYearID = int.Parse(Session["FinancialYearID"].ToString());
                        accountjournal.UserID          = Session["UserID"].ToString();
                        accountjournal.Remarks         = "Bank Voucher";
                        db.AccountJournals.Add(accountjournal);
                        db.SaveChanges();

                        var bankvoucherdetail = db.BankVoucherDetails.Where(d => d.BankVoucherID == bankvoucherfinal.BankVoucherID).ToList();
                        int voucheracc        = 0;
                        foreach (BankVoucherDetail d in bankvoucherdetail)
                        {
                            AccountJournalDetail accountjournaldetail = new AccountJournalDetail();
                            if (voucheracc == 0)
                            {
                                voucheracc = bankvoucherfinal.AccountHeadID;
                                accountjournaldetail.AccountJournalID = accountjournal.AccountJournalID;
                                accountjournaldetail.AccountHeadID    = bankvoucherfinal.AccountHeadID;
                                accountjournaldetail.AnalysisHeadID   = 0;
                                if (bankvoucherfinal.VoucherTypeID == 1)
                                {
                                    accountjournaldetail.Amount  = bankvoucherfinal.TotalAmount * -1;
                                    accountjournaldetail.Remarks = "Bank Voucher Receipt";
                                }
                                else
                                {
                                    accountjournaldetail.Amount  = bankvoucherfinal.TotalAmount;
                                    accountjournaldetail.Remarks = "Bank Voucher Payment";
                                }

                                db.AccountJournalDetails.Add(accountjournaldetail);
                                db.SaveChanges();
                            }
                            accountjournaldetail = new AccountJournalDetail();
                            accountjournaldetail.AccountJournalID = accountjournal.AccountJournalID;
                            accountjournaldetail.AccountHeadID    = d.AccountHeadID;
                            accountjournaldetail.AnalysisHeadID   = 0;
                            if (bankvoucherfinal.VoucherTypeID == 1)
                            {
                                accountjournaldetail.Amount  = d.Amount;
                                accountjournaldetail.Remarks = "Bank Voucher Receipt";
                            }
                            else
                            {
                                accountjournaldetail.Amount  = d.Amount * -1;
                                accountjournaldetail.Remarks = "Bank Voucher Payment";
                            }
                            db.AccountJournalDetails.Add(accountjournaldetail);
                            db.SaveChanges();
                        }
                    }

                    Session["msg"] = "Modified Successfully";
                    Session["err"] = "";
                }
            }
            catch {}
            return(Json(Session["err"], JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create([Bind(Include = "SalaryInstalmentsID,TeacherID,Title,Amount,Dop")] SalaryBookTeacher salaryinstalments)
        {
            bool      result = false;
            errordata data   = new errordata();

            data.type      = "error";
            Session["err"] = "Error, Please Check Input Fields";
            Session["msg"] = "";
            if (ModelState.IsValid)
            {
                SalaryBookTeacher exist = db.SalaryBookTeachers.Where(s => s.Title == salaryinstalments.Title && s.TeacherID == salaryinstalments.TeacherID).FirstOrDefault();
                if (exist != null)
                {
                    Session["err"] = "Salary Instalment already exists";
                    data.message   = Session["err"].ToString();
                    return(Json(data, JsonRequestBehavior.AllowGet));
                }
                db.SalaryBookTeachers.Add(salaryinstalments);
                db.SaveChanges();

                ModelState.Clear();

                result = true;
                if (result == true)
                {
                    //Account
                    int feedebitaccount    = 0;
                    int salarydebitaccount = 0;

                    int feecreditaccount    = 0;
                    int salarycreditaccount = 0;

                    var acheadassignList = db.AccountHeadAssigns.ToList();
                    foreach (AccountHeadAssign acheadassign in acheadassignList)
                    {
                        if (acheadassign.HeadAssignID == 1)
                        {
                            feedebitaccount = acheadassign.AccountHeadID;
                        }

                        if (acheadassign.HeadAssignID == 2)
                        {
                            feecreditaccount = acheadassign.AccountHeadID;
                        }
                        if (acheadassign.HeadAssignID == 3)
                        {
                            salarydebitaccount = acheadassign.AccountHeadID;
                        }
                        if (acheadassign.HeadAssignID == 4)
                        {
                            salarycreditaccount = acheadassign.AccountHeadID;
                        }
                    }

                    Teacher teacher         = db.Teachers.Find(salaryinstalments.TeacherID);
                    string  voucherno       = "EM" + teacher.IdCard + "-" + salaryinstalments.SalaryBookID.ToString();
                    var     accountjournals = db.AccountJournals.Where(a => a.VoucherNo == voucherno).ToList();
                    foreach (AccountJournal accountjournal1 in accountjournals)
                    {
                        var accountjournaldetails = db.AccountJournalDetails.Where(a => a.AccountJournalID == accountjournal1.AccountJournalID).ToList();
                        foreach (AccountJournalDetail accountjournaldetail1 in accountjournaldetails)
                        {
                            db.AccountJournalDetails.Remove(accountjournaldetail1);
                        }
                        db.SaveChanges();
                        db.AccountJournals.Remove(accountjournal1);
                    }
                    db.SaveChanges();

                    AccountJournal accountjournal = new AccountJournal();
                    accountjournal.VoucherNo       = voucherno;
                    accountjournal.VoucherType     = voucherno.Substring(0, 2);
                    accountjournal.TransactionDate = salaryinstalments.Dop;
                    accountjournal.BranchID        = int.Parse(Session["SchoolID"].ToString());
                    accountjournal.FinancialYearID = int.Parse(Session["AcademicYearID"].ToString());
                    accountjournal.UserID          = Session["UserID"].ToString();
                    accountjournal.Remarks         = "Teacher Salary";
                    db.AccountJournals.Add(accountjournal);
                    db.SaveChanges();

                    //debit
                    AccountJournalDetail accountjournaldetail = new AccountJournalDetail();
                    if (salaryinstalments.Amount > 0)
                    {
                        accountjournaldetail.AccountJournalID = accountjournal.AccountJournalID;
                        accountjournaldetail.AccountHeadID    = feedebitaccount;
                        accountjournaldetail.AnalysisHeadID   = 0;
                        accountjournaldetail.Amount           = salaryinstalments.Amount;
                        accountjournaldetail.Remarks          = "Teacher Salary: " + teacher.Name + ", Detail: " + salaryinstalments.Title + ", salary Debit";
                        db.AccountJournalDetails.Add(accountjournaldetail);
                        db.SaveChanges();
                    }

                    //credit
                    if (salaryinstalments.Amount > 0)
                    {
                        accountjournaldetail = new AccountJournalDetail();
                        accountjournaldetail.AccountJournalID = accountjournal.AccountJournalID;
                        accountjournaldetail.AccountHeadID    = feecreditaccount;
                        accountjournaldetail.AnalysisHeadID   = 0;
                        accountjournaldetail.Amount           = salaryinstalments.Amount * -1;
                        accountjournaldetail.Remarks          = "Teacher Salary: " + teacher.Name + ", Detail: " + salaryinstalments.Title + ", salary credit";
                        db.AccountJournalDetails.Add(accountjournaldetail);
                        db.SaveChanges();
                    }
                }

                Session["err"] = "";
                Session["msg"] = "Created Successfully";
            }
            data.message = Session["msg"].ToString();
            data.type    = "success";
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public void PartnerListTest()
        {
            var odooService = new OdooService(Connection);

            // res.partner search filter for user erp code
            // Sample erp code: TR1234567890
            var partnerFilter = new object[]
            {
                new object[] { "vat", "=", "TR1234567890" },
            };

            // res.partner for partner id
            var partnerIds = odooService.SearchAndRead("res.partner", partnerFilter, new string[] { "id", "name", "user_id", "ref" }, 0, 1);

            // account.account.type search filter
            // fields: receivable, payable
            var accountTypeFilter = new object[]
            {
                new object[] { "code", "in", new object[] { "receivable", "payable" } },
            };
            var accountTypes = odooService.SearchAndRead("account.account.type", accountTypeFilter, new string[] { "id" });

            var accountTypeIdList = new List <int>(10);

            foreach (var accountType in accountTypes)
            {
                foreach (DictionaryEntry de in accountType)
                {
                    int accountTypeId = (int)de.Value;
                    accountTypeIdList.Add(accountTypeId);
                }
            }

            // account.account search filter
            // fields: user_type
            var accountFilter = new object[]
            {
                new object[] { "user_type", "in", accountTypeIdList.ToArray() }
            };
            var accounts = odooService.SearchAndRead("account.account", accountFilter, new string[] { "id" });

            var accountIdList = new List <int>(50);

            foreach (var account in accounts)
            {
                foreach (DictionaryEntry de in account)
                {
                    int accountId = (int)de.Value;
                    accountIdList.Add(accountId);
                }
            }

            int partnerId = 0;

            foreach (var partner in partnerIds)
            {
                foreach (DictionaryEntry de in partner)
                {
                    if ((string)de.Key == "id")
                    {
                        partnerId = (int)de.Value;
                    }
                }
            }
            // account.move.line search filter
            // fields: partner_id and account_id
            var accountMoveFilter = new object[]
            {
                new object[] { "partner_id", "=", partnerId },
                new object[] { "account_id", "in", accountIdList.ToArray() }
            };
            // account.move.line select fields
            var accountMoveFields = new string[] { "name", "date", "date_maturity", "currency_id", "account_id", "amount_currency", "debit", "credit" };
            var accountMoveList   = odooService.SearchAndRead("account.move.line", accountMoveFilter, accountMoveFields);

            var accountMoveModelList = new List <AccountMoveLine>(50);

            foreach (var accountMove in accountMoveList)
            {
                var collection       = new Dictionary <string, object>();
                var accountMoveModel = new AccountMoveLine();
                foreach (DictionaryEntry de in accountMove)
                {
                    if (!collection.ContainsKey((string)de.Key))
                    {
                        collection.Add((string)de.Key, de.Value);
                    }
                }
                foreach (var parameter in collection)
                {
                    // We're continue if parameter value is coming null from Odoo.
                    if (parameter.Value is bool && !(bool)parameter.Value)
                    {
                        continue;
                    }

                    if (parameter.Key == "name")
                    {
                        accountMoveModel.Name = Convert.ToString(parameter.Value);
                    }
                    if (parameter.Key == "date")
                    {
                        accountMoveModel.Date = DateTime.ParseExact(parameter.Value.ToString(), "yyyy-MM-dd", System.Threading.Thread.CurrentThread.CurrentCulture);
                    }
                    if (parameter.Key == "date_maturity")
                    {
                        accountMoveModel.DateMaturity = DateTime.ParseExact(parameter.Value.ToString(), "yyyy-MM-dd", System.Threading.Thread.CurrentThread.CurrentCulture);
                    }
                    if (parameter.Key == "currency_id")
                    {
                        if (parameter.Value is object[])
                        {
                            accountMoveModel.CurrencyId = int.Parse((parameter.Value as object[])[0].ToString());
                        }
                    }
                    if (parameter.Key == "account_id")
                    {
                        if (parameter.Value is object[])
                        {
                            //var val = (parameter.Value as object[]).Length > 0 ? (parameter.Value as object[])[0] : null;
                            accountMoveModel.AccountId = int.Parse((parameter.Value as object[])[0].ToString());
                        }
                    }
                    if (parameter.Key == "amount_currency")
                    {
                        accountMoveModel.AmountCurrency = decimal.Parse(parameter.Value.ToString());
                    }
                    if (parameter.Key == "debit")
                    {
                        if (parameter.Value != null)
                        {
                            accountMoveModel.Debit = decimal.Parse(parameter.Value.ToString());
                        }
                    }
                    if (parameter.Key == "credit")
                    {
                        if (parameter.Value != null)
                        {
                            accountMoveModel.Credit = decimal.Parse(parameter.Value.ToString());
                        }
                    }
                }
                accountMoveModelList.Add(accountMoveModel);
            }

            var currencies      = odooService.SearchAndRead("res.currency", null, new string[] { "id", "name" });
            var accountJournals = odooService.SearchAndRead("account.journal", null, new string[] { "id", "name" });

            var currencyList = new List <Currency>();

            foreach (var currencyType in currencies)
            {
                var collection    = new Dictionary <string, object>();
                var currencyModel = new Currency();
                foreach (DictionaryEntry de in currencyType)
                {
                    if (!collection.ContainsKey((string)de.Key))
                    {
                        collection.Add((string)de.Key, de.Value);
                    }
                }
                foreach (var parameter in collection)
                {
                    if (parameter.Key == "id")
                    {
                        currencyModel.Id = (int)parameter.Value;
                    }
                    if (parameter.Key == "name")
                    {
                        currencyModel.Name = (string)parameter.Value;
                    }
                }
                currencyList.Add(currencyModel);
            }

            var accountJournalList = new List <AccountJournal>();

            foreach (var accountJournal in accountJournals)
            {
                var collection          = new Dictionary <string, object>();
                var accountJournalModel = new AccountJournal();
                foreach (DictionaryEntry de in accountJournal)
                {
                    if (!collection.ContainsKey((string)de.Key))
                    {
                        collection.Add((string)de.Key, de.Value);
                    }
                }

                foreach (var parameter in collection)
                {
                    if (parameter.Key == "id")
                    {
                        accountJournalModel.Id = (int)parameter.Value;
                    }
                    if (parameter.Key == "name")
                    {
                        accountJournalModel.Name = (string)parameter.Value;
                    }
                }
                accountJournalList.Add(accountJournalModel);
            }

            var query = from c in accountMoveModelList
                        join k in accountJournalList
                        on c.AccountId equals k.Id
                        join t in currencyList
                        on c.CurrencyId equals t.Id
                        into cs
                        from ces in cs.DefaultIfEmpty()
                        select new AccountMove
            {
                DocumentDate   = c.Date,
                ExpiryDate     = c.DateMaturity,
                DocumentType   = k.Name,
                DocumentNumber = c.Name,
                Description    = c.Name,
                Currency       = ces == null ? "TL" : ces.Name,
                CurrencyAmount = ces == null ? (c.Debit + (c.Credit * -1)) : c.AmountCurrency
            };

            var customerMove = query.ToList();

            Assert.IsNotNull(customerMove);
        }