public Purchase GetTotals(int id)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            _p = repo.GetForTotals(id);
            return(_p);
        }
        public bool CreatePurchaseOrder(Purchase p, int employeeId)
        {
            _p = p;

            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            EmployeeService es = new EmployeeService();

            _e = es.GetEmployee(employeeId);

            //set PO status to pending
            p.ApprovalStatus = ApprovalStatus.Pending;

            //set to current employee
            p.EmployeeId = employeeId;

            //set supervisor
            p.Supervisor = _e.Supervisor;

            Validate();
            if (Errors.Count == 0)
            {
                return(repo.AddPO(_p));
            }

            return(false);
        }
        public Purchase CheckSupervisor(int id)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            _p = repo.CheckSupervisorID(id);

            return(_p);
        }
        public IHttpActionResult CreatePO(PurchaseOrderModel po)
        {
            string             error = "";
            PurchaseOrderModel orm   = PurchaseOrderRepo.CreatePurchaseOrder(po, out error);

            if (error != "" || orm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(orm));
        }
        public IHttpActionResult UpdatePOStatusComplete(PurchaseOrderModel po)
        {
            string error = "";

            po = PurchaseOrderRepo.GetPurchaseOrderByID(po.PoId, out error);

            // if the staff has already updated the status to "received"
            if (po.Status == ConPurchaseOrder.Status.RECEIVED)
            {
                return(Ok(po));
            }
            po.Status = ConPurchaseOrder.Status.RECEIVED;

            List <PurchaseOrderDetailModel> podms = PurchaseOrderDetailRepo.GetPurchaseOrderDetailByID(po.PoId, out error);

            // if the purchase order is completed, the stock must be updated according to deliver qty.
            foreach (PurchaseOrderDetailModel podm in podms)
            {
                // get the inventory using the item id from purchaseorder detail model
                InventoryModel invm = InventoryRepo.GetInventoryByItemid(podm.Itemid, out error);

                // adding the stock accoring to deliver qty
                invm.Stock += podm.DelivQty;

                // update the inventory
                invm = InventoryRepo.UpdateInventory(invm, out error);


                InventoryTransactionModel invtm = new InventoryTransactionModel();

                invtm.InvID     = invm.Invid;
                invtm.ItemID    = invm.Itemid;
                invtm.Qty       = podm.DelivQty;
                invtm.TransType = ConInventoryTransaction.TransType.PURCHASEORDER_RECEIEVED;
                invtm.TransDate = DateTime.Now;
                invtm.Remark    = podm.PoId.ToString();
                invtm           = InventoryTransactionRepo.CreateInventoryTransaction(invtm, out error);
            }

            // updating the status
            PurchaseOrderModel pom = PurchaseOrderRepo.UpdatePurchaseOrder(po, out error);

            if (error != "" || pom == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "PO Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(pom));
        }
Example #6
0
 public StoreSupServiceImpl(AdjustmentVoucherRepo avrepo, EmployeeRepo erepo, PurchaseRequestRepo purreqrepo,
                            PurchaseOrderRepo porepo, SupplierRepo srepo, CollectionPointRepo crepo, IMailer mailservice, PurchaseOrderDetailRepo podrepo, TransactionRepo trepo)
 {
     this.avrepo      = avrepo;
     this.erepo       = erepo;
     this.purreqrepo  = purreqrepo;
     this.porepo      = porepo;
     this.srepo       = srepo;
     this.crepo       = crepo;
     this.mailservice = mailservice;
     this.podrepo     = podrepo;
     this.trepo       = trepo;
 }
        public IHttpActionResult UpdatePO(PurchaseOrderModel po)
        {
            string             error = "";
            PurchaseOrderModel orm   = PurchaseOrderRepo.UpdatePurchaseOrder(po, out error);

            if (error != "" || orm == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "PO Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(orm));
        }
        public IHttpActionResult GetPurchaseOrderById(int poid)
        {
            string             error = "";
            PurchaseOrderModel orm   =
                PurchaseOrderRepo.GetPurchaseOrderByID(poid, out error);

            if (error != "" || orm == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "PO Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(orm));
        }
        public IHttpActionResult GetPurchaseOrderByUserID(int userid)
        {
            string error = "";
            List <PurchaseOrderModel> orms =
                PurchaseOrderRepo.GetPurchaseOrderByPurchasedById(userid, out error);

            if (error != "" || orms == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "PO Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(orms));
        }
Example #10
0
 public StoreClerkServiceImpl(ProductRepo prepo, PurchaseRequestRepo purreqrepo, PurchaseOrderRepo porepo, PurchaseOrderDetailRepo podrepo,
                              RequisitionRepo rrepo, RequisitionDetailRepo rdrepo, TransactionRepo trepo, TenderQuotationRepo tqrepo, RetrievalRepo retrivrepo,
                              EmployeeRepo erepo, SupplierRepo srepo, IMailer mailservice, AdjustmentVoucherRepo avrepo, DepartmentRepo drepo, AdjustmentVoucherDetailRepo avdetrepo)
 {
     this.prepo       = prepo;
     this.purreqrepo  = purreqrepo;
     this.porepo      = porepo;
     this.podrepo     = podrepo;
     this.rrepo       = rrepo;
     this.rdrepo      = rdrepo;
     this.trepo       = trepo;
     this.retrivrepo  = retrivrepo;
     this.tqrepo      = tqrepo;
     this.erepo       = erepo;
     this.srepo       = srepo;
     this.mailservice = mailservice;
     this.avrepo      = avrepo;
     this.drepo       = drepo;
     this.avdetrepo   = avdetrepo;
 }
        public IHttpActionResult GetAllPurchaseOrders()
        {
            // declare and initialize error variable to accept the error from Repo
            string error = "";

            // get the list from purchase orderrepo and will insert the error if there is one
            List <PurchaseOrderModel> poms = PurchaseOrderRepo.GetAllPurchaseOrders(out error);

            // if the erorr is not blank or the purchase order list is null
            if (error != "" || poms == null)
            {
                // if the error is 404
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Purchase Order Not Found"));
                }
                // if the error is other one
                return(Content(HttpStatusCode.BadRequest, error));
            }
            // if there is no error
            return(Ok(poms));
        }
        public List <Purchase> UpdatePOSupervisor(int POId, string modificationReason)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            return(repo.UpdatePOSuper(POId, modificationReason));
        }
        public List <Purchase> UpdateTotal(int id, Purchase p)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            return(repo.UpdatePurchaseTotals(id, p));
        }
        public ApprovalStatus GetPurchaseStatus(int Id)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            return(repo.GetPurchaseStatus(Id));
        }
        public List <Purchase> GetPurchaseOrderByDate(DateTime start, DateTime end)
        {
            PurchaseOrderRepo POR = new PurchaseOrderRepo();

            return(POR.GetPOByDate(start, end));
        }
        public List <Purchase> GetPurchaseOrderByID(int Id)
        {
            PurchaseOrderRepo POR = new PurchaseOrderRepo();

            return(POR.GetPOById(Id));
        }
        public int GetPurchaseOrderByItemId(int Id)
        {
            PurchaseOrderRepo repo = new PurchaseOrderRepo();

            return(repo.GetPurchaseIDFromItem(Id));
        }
Example #18
0
 public UnitOfWork(string contextName)
     : this(new ReyukoContext(contextName))
 {
     DataMataUang                = new DataMataUangRepo(_context);
     ListDataMataUang            = new ListDataMataUangRepo(_context);
     KursMataUang                = new KursMataUangRepo(_context);
     DataPajak                   = new DataPajakRepo(_context);
     ListDataPajak               = new ListDataPajakRepo(_context);
     NamaPenyusutan              = new NamaPenyusutanRepo(_context);
     OptionAnnual                = new OptionAnnualRepo(_context);
     TabelPenyusutan             = new TabelPenyusutanRepo(_context);
     TypeDokumen                 = new TypeDokumenRepo(_context);
     NoteType                    = new NoteTypeRepo(_context);
     KelompokHartaTetap          = new KelompokHartaTetapRepo(_context);
     PeriodeAkuntansi            = new PeriodeAkuntansiRepo(_context);
     KodeTransaksi               = new KodeTransaksiRepo(_context);
     KategoriProduk              = new KategoriProdukRepo(_context);
     SatuanDasar                 = new SatuanDasarRepo(_context);
     GrupDiskon                  = new GrupDiskonRepo(_context);
     GolonganKontak              = new GolonganKontakRepo(_context);
     TypeKontak                  = new TypeKontakRepo(_context);
     Kontak                      = new KontakRepo(_context);
     ListKontak                  = new ListKontakRepo(_context);
     KlasifikasiKontak           = new KlasifikasiKontakRepo(_context);
     DataDepartemen              = new DataDepartemenRepo(_context);
     ListDataDepartemen          = new ListDataDepartemenRepo(_context);
     Lokasi                      = new LokasiRepo(_context);
     ListLokasi                  = new ListLokasiRepo(_context);
     DataProyek                  = new DataProyekRepo(_context);
     Alamat                      = new AlamatRepo(_context);
     Termspembayaran             = new TermspembayaranRepo(_context);
     Receivedgood                = new ReceivedgoodRepo(_context);
     produk                      = new produkRepo(_context);
     ListProduk                  = new ListProdukRepo(_context);
     HargaPokok                  = new HargaPokokRepo(_context);
     GrupProduk                  = new GrupProdukRepo(_context);
     Dokumen                     = new DokumenRepo(_context);
     InternalNote                = new InternalNoteRepo(_context);
     KlasifikasiAkun             = new KlasifikasiAkunRepo(_context);
     DefaultAkunMataUang         = new DefaultAkunMataUangRepo(_context);
     TypeProduk                  = new TypeProdukRepo(_context);
     RekeningPerkiraan           = new RekeningPerkiraanRepo(_context);
     PenerimaanBarang            = new PenerimaanBarangRepo(_context);
     ReturBarang                 = new ReturBarangRepo(_context);
     Radiobuttonrekper           = new RadiobuttonrekperRepo(_context);
     DataHartaTetap              = new DataHartaTetapRepo(_context);
     Diperoleh                   = new DiperolehRepo(_context);
     RekeningAnggaran            = new RekeningAnggaranRepo(_context);
     TransaksiJurnalUmum         = new TransaksiJurnalUmumRepo(_context);
     OrderJurnalUmum             = new OrderJurnalUmumRepo(_context);
     Invoice                     = new invoiceRepo(_context);
     BukuBesar                   = new BukuBesarRepo(_context);
     OrderPembayaranGaji         = new OrderPembayaranGajiRepo(_context);
     PembayaranGaji              = new PembayaranGajiRepo(_context);
     DropdownPPTBarang           = new DropdownPPTBarangRepo(_context);
     PermPenyTransferBarang      = new PermPenyTransferBarangRepo(_context);
     OrderInventori              = new OrderInventoriRepo(_context);
     CashActivity                = new CashActivityRepo(_context);
     DropdownPaymentCashActivity = new DropdownPaymentCashActivityRepo(_context);
     DataGiro                    = new DataGiroRepo(_context);
     OrderTransaksiCash          = new OrderTransaksiCashRepo(_context);
     Production                  = new productionRepo(_context);
     DropdownBankKas             = new DropdownBankKasRepo(_context);
     ListKonsinyasi              = new ListKonsinyasiRepo(_context);
     SalesOrder                  = new SalesOrderRepo(_context);
     Shopingchart                = new ShopingchartRepo(_context);
     Quotationrequest            = new QuotationrequestRepo(_context);
     Salesquotation              = new SalesquotationRepo(_context);
     DeliveryOrder               = new DeliveryorderRepo(_context);
     PurchaseOrder               = new PurchaseOrderRepo(_context);
     PurchaseDelivery            = new PurchasedeliveryRepo(_context);
     PurchaseReturn              = new PurchasereturnRepo(_context);
     SalesReturn                 = new SalesreturnRepo(_context);
     OrderProductioninput        = new OrderProductioninputRepo(_context);
     OrderProductioncustom       = new OrderProductioncustomRepo(_context);
     OrderFinishedproduk         = new OrderFinishedprodukRepo(_context);
     OrderProdukBeli             = new OrderProdukBeliRepo(_context);
     Rpp                 = new RppRepo(_context);
     Recap               = new RecapRepo(_context);
     Typelist            = new TypelistRepo(_context);
     OrderProdukJual     = new OrderProdukJualRepo(_context);
     ListOrderJual       = new ListOrderJualRepo(_context);
     OrderJasaJual       = new OrderJasaJualRepo(_context);
     OrderCustomJual     = new OrderCustomJualRepo(_context);
     ListOrderProduction = new ListOrderProductionRepo(_context);
     OrderJasaBeli       = new OrderJasaBeliRepo(_context);
     ListOrderBeli       = new ListOrderBeliRepo(_context);
     OrderCustomBeli     = new OrderCustomBeliRepo(_context);
 }