Exemplo n.º 1
0
        public ActionResult Index()
        {
            IList <MCostCenter> list = _mCostCenterRepository.GetAll();

            ViewData["CostCenterList"] = new SelectList(list, "Id", "CostCenterName");
            return(View());
        }
        public static GeneralLedgerViewModel CreateGeneralLedgerViewModel(ITJournalRepository tJournalRepository, IMCostCenterRepository mCostCenterRepository)
        {
            GeneralLedgerViewModel viewModel = new GeneralLedgerViewModel();

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Pilih Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName");
            return(viewModel);
        }
Exemplo n.º 3
0
        public static SelectList GetCostCenters(IMCostCenterRepository mCostCenterRepository, string defaultText)
        {
            IList <MCostCenter> list = mCostCenterRepository.GetAll();

            if (!string.IsNullOrEmpty(defaultText))
            {
                MCostCenter costCenter = new MCostCenter();
                costCenter.CostCenterName = defaultText;
                list.Insert(0, costCenter);
            }
            return(new SelectList(list, "Id", "CostCenterName"));
        }
Exemplo n.º 4
0
        public static ReportParamViewModel CreateReportParamViewModel(IMCostCenterRepository mCostCenterRepository, IMWarehouseRepository mWarehouseRepository, IMSupplierRepository mSupplierRepository, ITRecPeriodRepository tRecPeriodRepository, IMItemRepository mItemRepository)
        {
            ReportParamViewModel viewModel = new ReportParamViewModel();

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Semua Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName");

            IList <MWarehouse> listWarehouse = mWarehouseRepository.GetAll();
            MWarehouse         account       = new MWarehouse();

            account.WarehouseName = "-Semua Gudang-";
            listWarehouse.Insert(0, account);
            viewModel.WarehouseList = new SelectList(listWarehouse, "Id", "WarehouseName");

            IList <MSupplier> listSupplier = mSupplierRepository.GetAll();
            MSupplier         supplier     = new MSupplier();

            supplier.SupplierName = "-Semua Supplier-";
            listSupplier.Insert(0, supplier);
            viewModel.SupplierList = new SelectList(listSupplier, "Id", "SupplierName");

            IList <TRecPeriod> listRecPeriod = tRecPeriodRepository.GetAll();

            //TRecPeriod recPeriod = new TRecPeriod();
            //recPeriod.PeriodDesc = "-Pilih Period-";
            //listRecPeriod.Insert(0, recPeriod);
            viewModel.RecPeriodList = new SelectList(listRecPeriod, "Id", "PeriodDesc");

            IList <MItem> listItem = mItemRepository.GetAll();
            MItem         item     = new MItem();

            item.ItemName = "-Semua Item-";
            listItem.Insert(0, item);
            viewModel.ItemList = new SelectList(listItem, "Id", "ItemName");

            ArrayList arr = new ArrayList();

            for (int i = 1; i <= 5; i++)
            {
                var sel = new { Id = i };
                arr.Add(sel);
            }
            viewModel.ShiftNoList = new SelectList(arr, "Id", "Id");

            viewModel.DateFrom = DateTime.Today;
            viewModel.DateTo   = DateTime.Today;
            return(viewModel);
        }
Exemplo n.º 5
0
        public static PaymentViewModel Create(EnumPaymentType paymentType, ITPaymentRepository tPaymentRepository, ITPaymentDetRepository tPaymentDetRepository, IMSupplierRepository mSupplierRepository, IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository)
        {
            PaymentViewModel viewModel = new PaymentViewModel();

            TPayment p = new TPayment();

            p.SetAssignedIdTo(Guid.NewGuid().ToString());
            p.PaymentDate = DateTime.Today;
            p.PaymentDesc = string.Empty;
            p.PaymentType = paymentType.ToString();

            viewModel.Payment = p;

            viewModel.Title = string.Format("Pembayaran {0}", paymentType.ToString());

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Pilih Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName");

            //get label text
            switch (paymentType)
            {
            case EnumPaymentType.Piutang:
                viewModel.CashAccountLabel = "Deposit ke : ";

                //fill cust
                var values = from MCustomer cust in mCustomerRepository.GetAll()
                             select new { Id = cust.Id, Name = cust.PersonId != null ? cust.PersonId.PersonName : "-Pilih Konsumen-" };
                viewModel.TransByList = new SelectList(values, "Id", "Name");
                break;

            case EnumPaymentType.Hutang:
                viewModel.CashAccountLabel = "Deposit dari : ";

                IList <MSupplier> listAcc  = mSupplierRepository.GetAll();
                MSupplier         supplier = new MSupplier();
                supplier.SupplierName = "-Pilih Supplier-";
                listAcc.Insert(0, supplier);
                viewModel.TransByList = new SelectList(listAcc, "Id", "SupplierName");
                break;
            }
            return(viewModel);
        }
Exemplo n.º 6
0
        public virtual ActionResult GetList()
        {
            var           brands = _mCostCenterRepository.GetAll();
            StringBuilder sb     = new StringBuilder();
            MCostCenter   mCostCenter;

            sb.AppendFormat("{0}:{1};", string.Empty, "-Pilih Cost Center-");
            for (int i = 0; i < brands.Count; i++)
            {
                mCostCenter = brands[i];
                sb.AppendFormat("{0}:{1}", mCostCenter.Id, mCostCenter.CostCenterName);
                if (i < brands.Count - 1)
                {
                    sb.Append(";");
                }
            }
            return(Content(sb.ToString()));
        }
Exemplo n.º 7
0
        public static CashFormViewModel CreateCashFormViewModel(ITJournalRepository tJournalRepository, IMCostCenterRepository mCostCenterRepository, IMAccountRepository mAccountRepository)
        {
            CashFormViewModel viewModel = new CashFormViewModel();

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Pilih Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName");

            IList <MAccount> listAcc = mAccountRepository.GetAll();
            MAccount         account = new MAccount();

            account.AccountName = "-Pilih Akun Kas-";
            listAcc.Insert(0, account);
            viewModel.AccountList = new SelectList(listAcc, "Id", "AccountName");

            return(viewModel);
        }
Exemplo n.º 8
0
        public static UnitSalesFormViewModel CreateUnitSalesFormViewModel(IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository, ITTransUnitRepository tTransUnitRepository, string unitId)
        {
            UnitSalesFormViewModel viewModel = new UnitSalesFormViewModel();

            TTransUnit t = null;

            if (!string.IsNullOrEmpty(unitId))
            {
                t = tTransUnitRepository.GetByUnitId(unitId);
            }
            if (t == null)
            {
                t = new TTransUnit();
                t.SetAssignedIdTo(Guid.NewGuid().ToString());
                t.TransUnitDate = DateTime.Today;
            }
            viewModel.TransUnit = t;
            IList <MCustomer> listCust = mCustomerRepository.GetAll();
            var vals = from customer in listCust
                       select new { ID = customer.Id, Name = customer.PersonId.PersonName };

            //MCustomer cust = new MCustomer();
            //cust.CustomerDesc = "-Pilih Pembeli-";
            //vals.Union( .Insert(0, cust));
            viewModel.CustomerList = new SelectList(vals, "ID", "Name", t.CustomerId != null ? t.CustomerId.Id : null);

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Pilih Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName", t.CostCenterId != null ? t.CostCenterId.Id : null);

            var values = from EnumPaymentMethod e in Enum.GetValues(typeof(EnumPaymentMethod))
                         select new { ID = e, Name = e.ToString() };

            viewModel.PaymentMethodList = new SelectList(values, "Id", "Name", t.TransUnitPaymentMethod);

            return(viewModel);
        }
Exemplo n.º 9
0
        private ReportDataSource GetCostCenter()
        {
            ReportDataSource reportDataSource = new ReportDataSource("CostCenter", _mCostCenterRepository.GetAll());

            return(reportDataSource);
        }