Esempio n. 1
0
 public string InsertUpdateInvoice(SupplierInvoicesViewModel _supplierInvoicesObj)
 {
     try
     {
         if (_supplierInvoicesObj.TotalInvoiceAmount == 0)
         {
             throw new Exception("Please Enter Amount");
         }
         AppUA appUA = Session["AppUA"] as AppUA;
         _supplierInvoicesObj.commonObj             = new CommonViewModel();
         _supplierInvoicesObj.commonObj.CreatedBy   = appUA.UserName;
         _supplierInvoicesObj.commonObj.CreatedDate = common.GetCurrentDateTime();
         _supplierInvoicesObj.commonObj.UpdatedBy   = appUA.UserName;
         _supplierInvoicesObj.commonObj.UpdatedDate = common.GetCurrentDateTime();
         SupplierInvoicesViewModel SIVM = Mapper.Map <SupplierInvoices, SupplierInvoicesViewModel>(_supplierInvoicesBusiness.InsertUpdateInvoice(Mapper.Map <SupplierInvoicesViewModel, SupplierInvoices>(_supplierInvoicesObj)));
         if (_supplierInvoicesObj.ID != null && _supplierInvoicesObj.ID != Guid.Empty)
         {
             return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.UpdateSuccess, Records = SIVM }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = SIVM }));
         }
     }
     catch (Exception ex)
     {
         AppConstMessage cm = c.GetMessage(ex.Message);
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
     }
 }
Esempio n. 2
0
 public string GetSupplierInvoiceDetails(string ID)
 {
     try
     {
         SupplierInvoicesViewModel SupplierInvoiceObj = Mapper.Map <SupplierInvoices, SupplierInvoicesViewModel>(_supplierInvoicesBusiness.GetSupplierInvoiceDetails(Guid.Parse(ID)));
         if (SupplierInvoiceObj != null)
         {
             SupplierInvoiceObj.AccountCode = SupplierInvoiceObj.AccountCode + ":" + SupplierInvoiceObj.IsEmp;
             SupplierInvoiceObj.TotalInvoiceAmountstring = _commonBusiness.ConvertCurrency(SupplierInvoiceObj.TotalInvoiceAmount, 0);
             SupplierInvoiceObj.BalanceDuestring         = _commonBusiness.ConvertCurrency(SupplierInvoiceObj.BalanceDue, 0);
             SupplierInvoiceObj.PaidAmountstring         = _commonBusiness.ConvertCurrency((SupplierInvoiceObj.TotalInvoiceAmount - SupplierInvoiceObj.BalanceDue), 0);
         }
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = SupplierInvoiceObj }));
     }
     catch (Exception ex)
     {
         AppConstMessage cm = c.GetMessage(ex.Message);
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
     }
 }
Esempio n. 3
0
        public ActionResult Index(string id)
        {
            ViewBag.value = id;
            List <SelectListItem>     selectListItem = new List <SelectListItem>();
            SupplierInvoicesViewModel SI             = new SupplierInvoicesViewModel();

            SI.suppliersObj    = new SuppliersViewModel();
            SI.paymentTermsObj = new PaymentTermsViewModel();
            SI.companiesObj    = new CompaniesViewModel();
            SI.TaxTypeObj      = new TaxTypesViewModel();
            Settings s = new Settings();

            SI.InvoiceDateFormatted      = DateTime.Today.ToString(s.dateformat);
            SI.suppliersObj.SupplierList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <SuppliersViewModel> SuppList = Mapper.Map <List <Supplier>, List <SuppliersViewModel> >(_supplierBusiness.GetAllSuppliers());

            foreach (SuppliersViewModel Supp in SuppList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = Supp.CompanyName,
                    Value    = Supp.ID.ToString(),
                    Selected = false
                });
            }
            SI.suppliersObj.SupplierList = selectListItem;

            SI.paymentTermsObj.PaymentTermsList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <PaymentTermsViewModel> PayTermList = Mapper.Map <List <PaymentTerms>, List <PaymentTermsViewModel> >(_paymentTermsBusiness.GetAllPayTerms());

            foreach (PaymentTermsViewModel PayT in PayTermList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = PayT.Description,
                    Value    = PayT.Code,
                    Selected = false
                });
            }
            SI.paymentTermsObj.PaymentTermsList = selectListItem;

            SI.companiesObj.CompanyList = new List <SelectListItem>();
            selectListItem = new List <SelectListItem>();
            List <CompaniesViewModel> CompaniesList = Mapper.Map <List <Companies>, List <CompaniesViewModel> >(_companiesBusiness.GetAllCompanies());

            foreach (CompaniesViewModel Cmp in CompaniesList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = Cmp.Name,
                    Value    = Cmp.Code,
                    Selected = false
                });
            }
            SI.companiesObj.CompanyList = selectListItem;

            SI.TaxTypeObj.TaxTypesList = new List <SelectListItem>();
            selectListItem             = new List <SelectListItem>();
            List <TaxTypesViewModel> TaxTypeList = Mapper.Map <List <TaxTypes>, List <TaxTypesViewModel> >(_taxTypesBusiness.GetAllTaxTypes());

            foreach (TaxTypesViewModel TaTy in TaxTypeList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = TaTy.Description,
                    Value    = TaTy.Code,
                    Selected = false
                });
            }
            SI.TaxTypeObj.TaxTypesList = selectListItem;

            selectListItem = new List <SelectListItem>();
            List <ChartOfAccountsViewModel> chartOfAccountList = Mapper.Map <List <ChartOfAccounts>, List <ChartOfAccountsViewModel> >(_otherExpenseBusiness.GetAllAccountTypes("SUP"));

            foreach (ChartOfAccountsViewModel cav in chartOfAccountList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = cav.TypeDesc,
                    Value    = cav.Code + ":" + cav.ISEmploy,
                    Selected = false,
                });
            }
            SI.AccountTypesList = selectListItem;

            selectListItem = new List <SelectListItem>();
            List <EmployeeViewModel> employeeViewModelList = Mapper.Map <List <Employee>, List <EmployeeViewModel> >(_otherExpenseBusiness.GetAllEmployeesByType("OTH"));

            foreach (EmployeeViewModel EVM in employeeViewModelList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = EVM.Name,
                    Value    = EVM.ID.ToString(),
                    Selected = false,
                });
            }
            SI.SubTypeList = selectListItem;
            return(View(SI));
        }
Esempio n. 4
0
        public string GetSupplierAdvances(string ID)
        {
            SupplierInvoicesViewModel Advlist = Mapper.Map <SupplierInvoices, SupplierInvoicesViewModel>(_supplierInvoicesBusiness.GetSupplierAdvances(ID));

            return(JsonConvert.SerializeObject(new { Result = "OK", Records = Advlist }));
        }