Example #1
0
    private BillingItem fillBillDetail(BillDetail billDetail)
    {
        com.Sconit.Entity.Svp.BillingItem item = new com.Sconit.Entity.Svp.BillingItem();

        item.memo = string.Empty;
        item.billingQuantity =Convert.ToDouble(billDetail.BilledQty);
        item.unitPrice = billDetail.UnitPrice;
        item.unitPriceSpecified = true;

           UOM u = new UOM();
        u.abbreviation = billDetail.ActingBill.Uom.Code;
        u.description = billDetail.ActingBill.Uom.Description;

        Material m = new Material();
        m.quantityUOM = u;
        m.id = billDetail.ActingBill.Item.Code;
        m.no = billDetail.ActingBill.Item.Code;
        m.name = billDetail.ActingBill.Item.Description;
        m.description = billDetail.ActingBill.Item.Description;

        RequisitionOrder requisitionOrder = new RequisitionOrder();
        requisitionOrder.requisitionOrderNo = billDetail.ActingBill.OrderNo;

        DeliveryOrder deliveryOrder = new DeliveryOrder();
        deliveryOrder.requisitionOrder = requisitionOrder;

        ReceivingNote receiveNote = new ReceivingNote();
        receiveNote.id = billDetail.ActingBill.ReceiptNo;
        receiveNote.receivingNo = billDetail.ActingBill.ReceiptNo;
        receiveNote.deliveryOrder = deliveryOrder;

        ReceivingNoteItem receiveItem = new ReceivingNoteItem();
        receiveItem.material = m;
        receiveItem.receiveQuantity = Convert.ToDouble(billDetail.BilledQty);
        receiveItem.receiveQuantitySpecified = true;
        receiveItem.totalBillingQuantity = Convert.ToDouble( billDetail.BilledQty);
        receiveItem.totalBillingQuantitySpecified = true;
        receiveItem.receivingNote = receiveNote;

        item.material = m;
        item.receivingNoteItem = receiveItem;

        return item;
    }
    public ReceivingNote[] getReceivingNote(GetReceivingNoteRequest request)
    {

        DetachedCriteria criteria = DetachedCriteria.For<Receipt>();
        criteria.AddOrder(Order.Desc("ReceiptNo"));

        if (request.supplier != null && request.supplier != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.supplier));
        }
        if (request.supplierPartyCode != null && request.supplierPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyFrom.Code", request.supplierPartyCode));
        }
        if (request.customerPartyCode != null && request.customerPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyTo.Code", request.customerPartyCode));
        }

        if (request.customer != null && request.customer != string.Empty)
        {
            criteria.Add(Expression.Like("PartyTo.Name", request.customer));
        }

        if (request.receivingNo != null && request.receivingNo != string.Empty)
        {
            criteria.Add(Expression.Eq("ReceiptNo", request.receivingNo));
        }

        if (request.receiveDateFromSpecified)
        {
            criteria.Add(Expression.Ge("CreateDate", request.receiveDateFrom));
        }

        if (request.receiveDateToSpecified)
        {
            criteria.Add(Expression.Le("CreateDate", request.receiveDateTo));
        }


        IList<Receipt> receiptList = TheCriteriaMgr.FindAll<Receipt>(criteria);

        List<ReceivingNote> noteList = new List<ReceivingNote>();
        ReceivingNote note = new ReceivingNote();
        foreach (Receipt receipt in receiptList)
        {
            note.id = receipt.ReceiptNo;
            note.receivingNo = receipt.ReceiptNo;
            note.receiveDate = receipt.CreateDate;
            note.receiveDateSpecified = true;

            DeliveryOrder deliveryOrder = new DeliveryOrder();
            deliveryOrder.deliveryOrderNo = receipt.ReferenceIpNo;
            note.deliveryOrder = deliveryOrder;

            com.Sconit.Entity.Svp.Party partyFrom = new com.Sconit.Entity.Svp.Party();
            partyFrom.code = receipt.PartyFrom.Code;
            partyFrom.id = receipt.PartyFrom.Code;
            partyFrom.description = receipt.PartyFrom.Name;
            note.partyFrom = partyFrom;

            com.Sconit.Entity.Svp.Party partyTo = new com.Sconit.Entity.Svp.Party();
            partyTo.code = receipt.PartyTo.Code;
            partyTo.id = receipt.PartyTo.Code;
            partyTo.description = receipt.PartyTo.Name;
            note.partyTo = partyTo;

            com.Sconit.Entity.Svp.User receiveUser = new com.Sconit.Entity.Svp.User();
            receiveUser.id = receipt.CreateUser.Code;
            receiveUser.name = receipt.CreateUser.Name;
            note.receiveUser = receiveUser;

            noteList.Add(note);
        }

        return noteList.ToArray();

    }