Ejemplo n.º 1
0
        public dynamic Insert(CashBank model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.CashBank, Core.Constants.Constant.MenuGroupName.Master))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Add record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                model = _cashBankService.CreateObject(model, _accountService);
            }
            catch (Exception ex)
            {
                LOG.Error("Insert Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Ejemplo n.º 2
0
        public dynamic Insert(CashBank model)
        {
            try
            {
                model = _cashBankService.CreateObject(model);
            }
            catch (Exception ex)
            {
                LOG.Error("Insert Failed", ex);
                model.Errors.Add("Insert Failed", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Ejemplo n.º 3
0
        public void PopulateMasterData()
        {
            localWarehouse = new Warehouse()
            {
                Name        = "Sentral Solusi Data",
                Description = "Kali Besar Jakarta",
                Code        = "LCL"
            };
            localWarehouse = _warehouseService.CreateObject(localWarehouse, _warehouseItemService, _itemService);

            Pcs = new UoM()
            {
                Name = "Pcs"
            };
            _uomService.CreateObject(Pcs);

            Boxes = new UoM()
            {
                Name = "Boxes"
            };
            _uomService.CreateObject(Boxes);

            Tubs = new UoM()
            {
                Name = "Tubs"
            };
            _uomService.CreateObject(Tubs);

            blanket1 = new Item()
            {
                ItemTypeId   = _itemTypeService.GetObjectByName("Blanket").Id,
                Name         = "Blanket1",
                Category     = "Blanket",
                Sku          = "BLK1",
                UoMId        = Pcs.Id,
                SellingPrice = 50000,
                AvgPrice     = 50000
            };

            blanket1 = _itemService.CreateObject(blanket1, _uomService, _itemTypeService, _warehouseItemService, _warehouseService, _priceMutationService, _contactGroupService);

            blanket2 = new Item()
            {
                ItemTypeId   = _itemTypeService.GetObjectByName("Blanket").Id,
                Name         = "Blanket2",
                Category     = "Blanket",
                Sku          = "BLK2",
                UoMId        = Pcs.Id,
                SellingPrice = 72000,
                AvgPrice     = 72000
            };

            blanket2 = _itemService.CreateObject(blanket2, _uomService, _itemTypeService, _warehouseItemService, _warehouseService, _priceMutationService, _contactGroupService);

            blanket3 = new Item()
            {
                ItemTypeId   = _itemTypeService.GetObjectByName("Blanket").Id,
                Name         = "Blanket3",
                Category     = "Blanket",
                Sku          = "BLK3",
                UoMId        = Pcs.Id,
                SellingPrice = 100000,
                AvgPrice     = 100000
            };

            blanket3 = _itemService.CreateObject(blanket3, _uomService, _itemTypeService, _warehouseItemService, _warehouseService, _priceMutationService, _contactGroupService);

            contact = new Contact()
            {
                Name         = "President of Indonesia",
                Address      = "Istana Negara Jl. Veteran No. 16 Jakarta Pusat",
                ContactNo    = "021 3863777",
                PIC          = "Mr. President",
                PICContactNo = "021 3863777",
                Email        = "*****@*****.**"
            };
            contact = _contactService.CreateObject(contact, _contactGroupService);

            cashBank = new CashBank()
            {
                Name        = "Rekening BRI",
                Description = "Untuk cashflow",
                IsBank      = true
            };
            _cashBankService.CreateObject(cashBank, _accountService);

            cashBankAdjustment = new CashBankAdjustment()
            {
                CashBankId     = cashBank.Id,
                Amount         = 1000000000,
                AdjustmentDate = DateTime.Today
            };
            _cashBankAdjustmentService.CreateObject(cashBankAdjustment, _cashBankService);
            _cashBankAdjustmentService.ConfirmObject(cashBankAdjustment, DateTime.Now, _cashMutationService, _cashBankService,
                                                     _generalLedgerJournalService, _accountService, _closingService);

            StockAdjustment sa = new StockAdjustment()
            {
                AdjustmentDate = DateTime.Now,
                Code           = "SA001",
                WarehouseId    = localWarehouse.Id
            };

            _stockAdjustmentService.CreateObject(sa, _warehouseService);

            StockAdjustmentDetail sad1 = new StockAdjustmentDetail()
            {
                StockAdjustmentId = sa.Id,
                ItemId            = blanket1.Id,
                Quantity          = 100000,
                Code  = "SAD001",
                Price = 50000
            };

            _stockAdjustmentDetailService.CreateObject(sad1, _stockAdjustmentService, _itemService, _warehouseItemService);

            StockAdjustmentDetail sad2 = new StockAdjustmentDetail()
            {
                StockAdjustmentId = sa.Id,
                ItemId            = blanket2.Id,
                Quantity          = 100000,
                Code  = "SAD002",
                Price = 50000
            };

            _stockAdjustmentDetailService.CreateObject(sad2, _stockAdjustmentService, _itemService, _warehouseItemService);

            StockAdjustmentDetail sad3 = new StockAdjustmentDetail()
            {
                StockAdjustmentId = sa.Id,
                ItemId            = blanket3.Id,
                Quantity          = 100000,
                Code  = "SAD003",
                Price = 50000
            };

            _stockAdjustmentDetailService.CreateObject(sad3, _stockAdjustmentService, _itemService, _warehouseItemService);

            _stockAdjustmentService.ConfirmObject(sa, DateTime.Today, _stockAdjustmentDetailService, _stockMutationService, _itemService, _barringService,
                                                  _warehouseItemService, _generalLedgerJournalService, _accountService, _closingService);
        }
Ejemplo n.º 4
0
        public void PopulateMasterData()
        {
            localWarehouse = new Warehouse()
            {
                Name        = "Sentral Solusi Data",
                Description = "Kali Besar Jakarta",
                Code        = "LCL"
            };
            localWarehouse = _warehouseService.CreateObject(localWarehouse, _warehouseItemService, _itemService);

            Pcs = new UoM()
            {
                Name = "Pcs"
            };
            _uomService.CreateObject(Pcs);

            Boxes = new UoM()
            {
                Name = "Boxes"
            };
            _uomService.CreateObject(Boxes);

            Tubs = new UoM()
            {
                Name = "Tubs"
            };
            _uomService.CreateObject(Tubs);

            blanket1 = new Item()
            {
                ItemTypeId = _itemTypeService.GetObjectByName("Blanket").Id,
                Name       = "Blanket1",
                Category   = "Blanket",
                Sku        = "BLK1",
                UoMId      = Pcs.Id
            };

            blanket1 = _itemService.CreateObject(blanket1, _uomService, _itemTypeService, _warehouseItemService, _warehouseService);
            _itemService.AdjustQuantity(blanket1, 100000);
            _warehouseItemService.AdjustQuantity(_warehouseItemService.FindOrCreateObject(localWarehouse.Id, blanket1.Id), 100000);

            blanket2 = new Item()
            {
                ItemTypeId = _itemTypeService.GetObjectByName("Blanket").Id,
                Name       = "Blanket2",
                Category   = "Blanket",
                Sku        = "BLK2",
                UoMId      = Pcs.Id
            };

            blanket2 = _itemService.CreateObject(blanket2, _uomService, _itemTypeService, _warehouseItemService, _warehouseService);
            _itemService.AdjustQuantity(blanket2, 100000);
            _warehouseItemService.AdjustQuantity(_warehouseItemService.FindOrCreateObject(localWarehouse.Id, blanket2.Id), 100000);

            blanket3 = new Item()
            {
                ItemTypeId = _itemTypeService.GetObjectByName("Blanket").Id,
                Name       = "Blanket3",
                Category   = "Blanket",
                Sku        = "BLK3",
                UoMId      = Pcs.Id
            };

            blanket3 = _itemService.CreateObject(blanket3, _uomService, _itemTypeService, _warehouseItemService, _warehouseService);
            _itemService.AdjustQuantity(blanket3, 100000);
            _warehouseItemService.AdjustQuantity(_warehouseItemService.FindOrCreateObject(localWarehouse.Id, blanket3.Id), 100000);

            contact = new Contact()
            {
                Name         = "President of Indonesia",
                Address      = "Istana Negara Jl. Veteran No. 16 Jakarta Pusat",
                ContactNo    = "021 3863777",
                PIC          = "Mr. President",
                PICContactNo = "021 3863777",
                Email        = "*****@*****.**"
            };
            contact = _contactService.CreateObject(contact);

            cashBank = new CashBank()
            {
                Name        = "Rekening BRI",
                Description = "Untuk cashflow"
            };
            _cashBankService.CreateObject(cashBank);

            cashBankAdjustment = new CashBankAdjustment()
            {
                CashBankId     = cashBank.Id,
                Amount         = 1000000000,
                AdjustmentDate = DateTime.Today
            };
            _cashBankAdjustmentService.CreateObject(cashBankAdjustment, _cashBankService);
            _cashBankAdjustmentService.ConfirmObject(cashBankAdjustment, DateTime.Now, _cashMutationService, _cashBankService);
        }