Esempio n. 1
0
        public int InsertPoLineLocation(POLineLocationModel model)
        {
            model.CreationDate   = DateTime.Now;
            model.LastUpdateDate = DateTime.Now;

            return(factory.POLineLocationDao.Insert(model));
        }
        public void Delete(POLineLocationModel model)
        {
            string sql = @"DELETE FROM po_line_locations_all WHERE line_location_id = @line_location_id";

            object[] parms = { "@line_location_id", model.LineLocationId };
            db.Update(sql, parms);
        }
        private void GeneratePOLocation(IEnumerable <POReceiptLineModel> lines)
        {
            //POReceiptHeaderModel recHead = _view.headSeleted;
            IEnumerable <POReceiptLineModel> resultLines = lines;

            if (_view.headSeleted.ReceiptMethod == "RETURN")
            {
                resultLines = lines.Where(x => x.QuantityShipped < 0).ToList();
            }

            foreach (var recLine in resultLines)
            {
                POLineLocationModel loc = new POLineLocationModel();
                loc.PoHeaderId             = recLine.PoHeaderId;
                loc.PoLineId               = recLine.PoLineId;
                loc.Quantity               = recLine.QuantityShipped;
                loc.QuantityReceived       = recLine.QuantityShipped;
                loc.UnitMeasLookupCode     = recLine.UnitOfMeasure;
                loc.InspectionRequiredFlag = recLine.QcRequireInspcFlag;
                loc.ReceiptHeaderId        = recLine.ReceiptHeaderId;
                loc.ReceiptLineId          = recLine.ReceiptLineId;
                loc.ConfirmFlag            = "N";

                int id = _repoPurchase.InsertPoLineLocation(loc);
            }

            //Get PO Lines to Update PO Status ***Not support multi PO in same Receive.
            int poId = lines.FirstOrDefault().PoHeaderId;
            List <POLineModel> poLines = _repoPurchase.GetPOLineByPOID(poId);

            var result = poLines.GroupBy(x => x.ReceivedStatus)
                         .Select(group => new { ReceivedStatus = group.Key, Items = group.ToList() })
                         .ToList();

            POHeaderModel po = _repoPurchase.GetPOByID(poId);

            if (result.Count() == 1)
            {
                if (result.FirstOrDefault().ReceivedStatus == "Fill")
                {
                    po.StatusCode   = "FINALLY CLOSED";
                    po.ReceivedFlag = true;
                }
                else
                {
                    po.StatusCode   = "OPEN";
                    po.ReceivedFlag = false;
                }
            }
            else
            {
                po.StatusCode   = "OPEN";
                po.ReceivedFlag = false;
            }
            _repoPurchase.UpdatePO(po);
        }
 private void ConfirmPOLocation(IEnumerable <POReceiptLineModel> lines)
 {
     //POReceiptHeaderModel recHead = _view.headSeleted;
     foreach (var recLine in lines)
     {
         POLineLocationModel loc = _repoPurchase.GetLineLocationByPOLineID(recLine.PoLineId).Where(x => x.ReceiptLineId == recLine.ReceiptLineId).FirstOrDefault();
         loc.ConfirmFlag = "Y";
         _repoPurchase.UpdatePoLineLocation(loc);
     }
 }
 private object[] Take(POLineLocationModel model)
 {
     return(new object[]
     {
         "@line_location_id", model.LineLocationId,
         "@last_update_date", model.LastUpdateDate,
         "@last_updated_by", model.LastUpdatedBy,
         "@po_header_id", model.PoHeaderId,
         "@po_line_id", model.PoLineId,
         "@creation_date", model.CreationDate,
         "@created_by", model.CreatedBy,
         "@quantity", model.Quantity,
         "@quantity_received", model.QuantityReceived,
         "@quantity_accepted", model.QuantityAccepted,
         "@quantity_rejected", model.QuantityRejected,
         "@quantity_billed", model.QuantityBilled,
         "@quantity_cancelled", model.QuantityCancelled,
         "@unit_meas_lookup_code", model.UnitMeasLookupCode,
         "@po_release_id", model.PoReleaseId,
         "@ship_to_location_id", model.ShipToLocationId,
         "@ship_via_lookup_code", model.ShipViaLookupCode,
         "@need_by_date", model.NeedByDate,
         "@promised_date", model.PromisedDate,
         "@last_accept_date", model.LastAcceptDate,
         "@price_override", model.PriceOverride,
         "@encumbered_flag", (model.EncumberedFlag) ? "Y" : "N",
         "@encumbered_date", model.EncumberedDate,
         "@unencumbered_quantity", model.UnencumberedQuantity,
         "@fob_lookup_code", model.FobLookupCode,
         "@freight_terms_lookup_code", model.FreightTermsLookupCode,
         "@taxable_flag", (model.TaxableFlag) ? "Y" : "N",
         "@tax_name", model.TaxName,
         "@estimated_tax_amount", model.EstimatedTaxAmount,
         "@inspection_required_flag", (model.InspectionRequiredFlag) ? "Y" : "N",
         "@receipt_required_flag", (model.ReceiptRequiredFlag) ? "Y" : "N",
         "@shipment_num", model.ShipmentNum,
         "@receipt_header_id", model.ReceiptHeaderId,
         "@receipt_line_id", model.ReceiptLineId,
         "@org_id", model.OrgId,
         "@tax_code_id", model.TaxCodeId,
         "@calculate_tax_flag", (model.CalculateTaxFlag) ? "Y" : "N",
         "@note_to_receiver", model.NoteToReceiver,
         "@amount", model.Amount,
         "@amount_received", model.AmountReceived,
         "@amount_billed", model.AmountBilled,
         "@amount_cancelled", model.AmountCancelled,
         "@amount_rejected", model.AmountRejected,
         "@amount_accepted", model.AmountAccepted,
         "@confirm_flag", model.ConfirmFlag
     });
 }
        public void Update(POLineLocationModel model)
        {
            string sql =
                @"UPDATE po_line_locations_all
               SET last_update_date = GETDATE()
                  ,last_updated_by = @last_updated_by
                  ,po_header_id = @po_header_id
                  ,po_line_id = @po_line_id
                  ,quantity = @quantity
                  ,quantity_received = @quantity_received
                  ,quantity_accepted = @quantity_accepted
                  ,quantity_rejected = @quantity_rejected
                  ,quantity_billed = @quantity_billed
                  ,quantity_cancelled = @quantity_cancelled
                  ,unit_meas_lookup_code = @unit_meas_lookup_code
                  ,po_release_id = @po_release_id
                  ,ship_to_location_id = @ship_to_location_id
                  ,ship_via_lookup_code = @ship_via_lookup_code
                  ,need_by_date = @need_by_date
                  ,promised_date = @promised_date
                  ,last_accept_date = @last_accept_date
                  ,price_override = @price_override
                  ,encumbered_flag = @encumbered_flag
                  ,encumbered_date = @encumbered_date
                  ,unencumbered_quantity = @unencumbered_quantity
                  ,fob_lookup_code = @fob_lookup_code
                  ,freight_terms_lookup_code = @freight_terms_lookup_code
                  ,taxable_flag = @taxable_flag
                  ,tax_name = @tax_name
                  ,estimated_tax_amount = @estimated_tax_amount
                  ,inspection_required_flag = @inspection_required_flag
                  ,receipt_required_flag = @receipt_required_flag
                  ,shipment_num = @shipment_num
                  ,receipt_header_id = @receipt_header_id
                  ,receipt_line_id = @receipt_line_id
                  ,org_id = @org_id
                  ,tax_code_id = @tax_code_id
                  ,calculate_tax_flag = @calculate_tax_flag
                  ,note_to_receiver = @note_to_receiver
                  ,amount = @amount
                  ,amount_received = @amount_received
                  ,amount_billed = @amount_billed
                  ,amount_cancelled = @amount_cancelled
                  ,amount_rejected = @amount_rejected
                  ,amount_accepted = @amount_accepted
                  ,confirm_flag = @confirm_flag
             WHERE line_location_id = @line_location_id";

            db.Update(sql, Take(model));
        }
        public int Insert(POLineLocationModel model)
        {
            string sql =
                @"INSERT INTO po_line_locations_all
	                    (last_update_date, last_updated_by, po_header_id
	                    , po_line_id, creation_date, created_by
	                    , quantity, quantity_received, quantity_accepted
	                    , quantity_rejected, quantity_billed, quantity_cancelled
	                    , unit_meas_lookup_code, po_release_id, ship_to_location_id
	                    , ship_via_lookup_code, need_by_date, promised_date
	                    , last_accept_date, price_override, encumbered_flag
	                    , encumbered_date, unencumbered_quantity, fob_lookup_code
	                    , freight_terms_lookup_code, taxable_flag, tax_name
	                    , estimated_tax_amount, inspection_required_flag, receipt_required_flag
	                    , shipment_num, receipt_header_id, receipt_line_id
	                    , org_id, tax_code_id, calculate_tax_flag
	                    , note_to_receiver, amount, amount_received
	                    , amount_billed, amount_cancelled, amount_rejected
	                    , amount_accepted, confirm_flag)
                    VALUES
	                    (GETDATE(), @last_updated_by, @po_header_id
	                    , @po_line_id, GETDATE(), @created_by
	                    , @quantity, @quantity_received, @quantity_accepted
	                    , @quantity_rejected, @quantity_billed, @quantity_cancelled
	                    , @unit_meas_lookup_code, @po_release_id, @ship_to_location_id
	                    , @ship_via_lookup_code, @need_by_date, @promised_date
	                    , @last_accept_date, @price_override, @encumbered_flag
	                    , @encumbered_date, @unencumbered_quantity, @fob_lookup_code
	                    , @freight_terms_lookup_code, @taxable_flag, @tax_name
	                    , @estimated_tax_amount, @inspection_required_flag, @receipt_required_flag
	                    , @shipment_num, @receipt_header_id, @receipt_line_id
	                    , @org_id, @tax_code_id, @calculate_tax_flag
	                    , @note_to_receiver, @amount, @amount_received
	                    , @amount_billed, @amount_cancelled, @amount_rejected
	                    , @amount_accepted, @confirm_flag)"    ;

            return(db.Insert(sql, Take(model)));
        }
Esempio n. 8
0
 public void DeletePoLineLocation(POLineLocationModel model)
 {
     factory.POLineLocationDao.Delete(model);
 }
Esempio n. 9
0
        public void UpdatePoLineLocation(POLineLocationModel model)
        {
            model.LastUpdateDate = DateTime.Now;

            factory.POLineLocationDao.Update(model);
        }