Ejemplo n.º 1
0
        public IActionResult DeleteSalesReturnItem(long id)
        {
            SalesReturnItem SalesReturnItem = returnitem_repo.Find(id);

            if (SalesReturnItem == null)
            {
                return(NotFound());
            }

            returnitem_repo.Delete(SalesReturnItem);
            return(Ok());
        }
Ejemplo n.º 2
0
        private IList getItems()
        {
            IList items = new ArrayList();

            for (int i = 0; i < itemsDataGrid.Rows.Count; i++)
            {
                DeliveryOrderItem poi = (DeliveryOrderItem)itemsDataGrid[scanColumn.Index, i].Tag;
                if (poi == null)
                {
                    continue;
                }
                Part p = (Part)itemsDataGrid[codeColumn.Index, i].Tag;
                if (itemsDataGrid[unitColumn.Index, i].Value == null)
                {
                    continue;
                }
                Unit u = (Unit)Utils.FindEntityInList(itemsDataGrid[unitColumn.Index, i].Value.ToString(), m_units);
                if ((p == null) || (u == null))
                {
                    continue;
                }
                SalesReturnItem st = (SalesReturnItem)itemsDataGrid.Rows[i].Tag;
                if (st == null)
                {
                    st = new SalesReturnItem();
                }
                itemsDataGrid.Rows[i].Tag = st;
                st.EVENT     = m_prn;
                st.PART      = p;
                st.WAREHOUSE = (Warehouse)Utils.FindEntityInList(itemsDataGrid[warehouseColumn.Index, i].Value.ToString(), m_warehouses);
                st.QYTAMOUNT = Convert.ToDouble(itemsDataGrid[QtyColumn.Index, i].Value);
                st.UNIT      = u;
                st.DO_ITEM   = poi;
                st.NOTES     = itemsDataGrid[notesColumn.Index, i].Value == null ? "" : itemsDataGrid[notesColumn.Index, i].Value.ToString();
                if (st.QYTAMOUNT == 0)
                {
                    continue;
                }
                items.Add(st);
            }
            return(items);
        }
Ejemplo n.º 3
0
 public void Create(SalesReturnItem SalesReturnItem)
 {
     _SalesReturnItemRepository.Add(SalesReturnItem);
     _UnitOfWork.Commit();
 }
Ejemplo n.º 4
0
        private void loadMovement()
        {
            movemntkryptonDataGridView.Rows.Clear();
            if (m_part.ID == 0)
            {
                return;
            }
            IList movs = r_part.GetAllEvents(m_part.ID);

            foreach (EventItem itm in movs)
            {
                int r = movemntkryptonDataGridView.Rows.Add();
                movemntkryptonDataGridView[dateMovementColumn.Index, r].Value      = itm.EVENT.TRANSACTION_DATE;
                movemntkryptonDataGridView[eventCodeMovementColumn.Index, r].Value = itm.EVENT.CODE;
                movemntkryptonDataGridView[eventTypeMovementColumn.Index, r].Value = itm.STOCK_CARD_ENTRY_TYPE.ToString();
                movemntkryptonDataGridView[QtyMovementColumn.Index, r].Value       = itm.GetAmountInSmallestUnit();
                movemntkryptonDataGridView[unitMovementColumn.Index, r].Value      = m_part.UNIT.CODE;
                movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value    = "-";
                switch (itm.STOCK_CARD_ENTRY_TYPE)
                {
                case StockCardEntryType.PurchaseOrder:
                    PurchaseOrderItem pi = (PurchaseOrderItem)itm;
                    PurchaseOrder     p  = (PurchaseOrder)pi.EVENT;
                    p.SUPPLIER = (Supplier)r_sup.GetById(p.SUPPLIER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = p.SUPPLIER.NAME;
                    break;

                case StockCardEntryType.SalesOrder:
                    SalesOrderItem soi = (SalesOrderItem)itm;
                    SalesOrder     so  = (SalesOrder)soi.EVENT;
                    so.CUSTOMER = (Customer)r_cus.GetById(so.CUSTOMER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = so.CUSTOMER.NAME;
                    break;

                case StockCardEntryType.GoodReceiveNote:
                    GoodReceiveNoteItem grni = (GoodReceiveNoteItem)itm;
                    GoodReceiveNote     grn  = (GoodReceiveNote)grni.EVENT;
                    grn.SUPPLIER = (Supplier)r_sup.GetById(grn.SUPPLIER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = grn.SUPPLIER.NAME;
                    break;

                case StockCardEntryType.DeliveryOrder:
                    DeliveryOrderItem doi = (DeliveryOrderItem)itm;
                    DeliveryOrder     dor = (DeliveryOrder)doi.EVENT;
                    dor.CUSTOMER = (Customer)r_cus.GetById(dor.CUSTOMER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = dor.CUSTOMER.NAME;
                    break;

                case StockCardEntryType.SupplierInvoice:
                    SupplierInvoiceItem sii = (SupplierInvoiceItem)itm;
                    SupplierInvoice     si  = (SupplierInvoice)sii.EVENT;
                    si.SUPPLIER = (Supplier)r_sup.GetById(si.SUPPLIER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = si.SUPPLIER.NAME;
                    break;

                case StockCardEntryType.CustomerInvoice:
                    CustomerInvoiceItem cii = (CustomerInvoiceItem)itm;
                    CustomerInvoice     ci  = (CustomerInvoice)cii.EVENT;
                    ci.CUSTOMER = (Customer)r_cus.GetById(ci.CUSTOMER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = ci.CUSTOMER.NAME;
                    break;

                case StockCardEntryType.PurchaseReturn:
                    PurchaseReturnItem pri = (PurchaseReturnItem)itm;
                    PurchaseReturn     pr  = (PurchaseReturn)pri.EVENT;
                    pr.SUPPLIER = (Supplier)r_sup.GetById(pr.SUPPLIER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = pr.SUPPLIER.NAME;
                    break;

                case StockCardEntryType.SalesReturn:
                    SalesReturnItem sri = (SalesReturnItem)itm;
                    SalesReturn     sr  = (SalesReturn)sri.EVENT;
                    sr.CUSTOMER = (Customer)r_cus.GetById(sr.CUSTOMER);
                    movemntkryptonDataGridView[vendorMovementColumn.Index, r].Value = sr.CUSTOMER.NAME;
                    break;
                }
                movemntkryptonDataGridView[statusMovementColumn.Index, r].Value = itm.EVENT.POSTED.ToString();
            }
            UserSetting.AddNumberToGrid(movemntkryptonDataGridView);
        }
Ejemplo n.º 5
0
 public IActionResult AddSalesReturnItem([FromBody] SalesReturnItem model)
 {
     returnitem_repo.Add(model);
     return(new OkObjectResult(new { SalesReturnItemID = model.SalesReturnItemId }));
 }
Ejemplo n.º 6
0
        void dataItemskryptonDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (m_editMode == EditMode.View)
            {
                return;
            }
            itemsDataGrid.Rows[e.RowIndex].ErrorText = "";
            if (!itemsDataGrid[e.ColumnIndex, e.RowIndex].IsInEditMode)
            {
                return;
            }

            if (e.ColumnIndex == scanColumn.Index)
            {
                if (e.FormattedValue.ToString() == "")
                {
                    return;
                }

                IList addedPI = new ArrayList();
                for (int i = 0; i < itemsDataGrid.Rows.Count; i++)
                {
                    if (i == e.RowIndex)
                    {
                        continue;
                    }
                    DeliveryOrderItem pi = (DeliveryOrderItem)itemsDataGrid[scanColumn.Index, i].Tag;
                    if (pi == null)
                    {
                        continue;
                    }
                    addedPI.Add(pi.ID);
                }
                IList res = r_grn.FindSObyPartAndDONo(e.FormattedValue.ToString(), addedPI, ((Customer)supplierkryptonComboBox.SelectedItem).ID, dateKryptonDateTimePicker.Value);
                if (res.Count == 0)
                {
                    using (SearchDOForSRForm fr = new SearchDOForSRForm(e.FormattedValue.ToString(), (Customer)supplierkryptonComboBox.SelectedItem, addedPI, m_mainForm.CurrentUser, dateKryptonDateTimePicker.Value))
                    {
                        fr.ShowDialog();
                        IList result = fr.RESULT;
                        m_poItems = result;
                    }
                }
                else
                {
                    m_poItems = res;
                }
            }
            if (QtyColumn.Index == e.ColumnIndex)
            {
                DeliveryOrderItem pi = (DeliveryOrderItem)itemsDataGrid[scanColumn.Index, e.RowIndex].Tag;
                if (pi == null)
                {
                    return;
                }
                Part p = (Part)itemsDataGrid[codeColumn.Index, e.RowIndex].Tag;
                if (p == null)
                {
                    return;
                }
                Unit u = (Unit)Utils.FindEntityInList(itemsDataGrid[unitColumn.Index, e.RowIndex].Value.ToString(), m_units);
                if (u == null)
                {
                    return;
                }
                p.UNIT_CONVERSION_LIST = r_part.GetUnitConversions(p.ID);
                SalesReturnItem sample = new SalesReturnItem();
                sample.PART      = p;
                sample.UNIT      = u;
                sample.QYTAMOUNT = Convert.ToDouble(e.FormattedValue);
                double qty  = sample.GetAmountInSmallestUnit();
                double rest = r_grn.GetOutstandingReturned(pi.ID) - qty;
                if (rest < 0)
                {
                    e.Cancel = true;
                    itemsDataGrid.Rows[e.RowIndex].ErrorText = "Quantity exceed outstanding quantity";
                }
                // itemsDataGrid[OutstandingPOColumn.Index, e.RowIndex].Value = r_grn.GetOutstandingReturned(pi.ID);
            }
            if (unitColumn.Index == e.ColumnIndex)
            {
                DeliveryOrderItem pi = (DeliveryOrderItem)itemsDataGrid[scanColumn.Index, e.RowIndex].Tag;
                if (pi == null)
                {
                    return;
                }
                Part p = (Part)itemsDataGrid[codeColumn.Index, e.RowIndex].Tag;
                if (p == null)
                {
                    return;
                }
                Unit u = (Unit)Utils.FindEntityInList(e.FormattedValue.ToString(), m_units);
                if (u == null)
                {
                    return;
                }
                p.UNIT_CONVERSION_LIST = r_part.GetUnitConversions(p.ID);
                DeliveryOrderItem sample = new DeliveryOrderItem();
                sample.PART      = p;
                sample.UNIT      = u;
                sample.QYTAMOUNT = Convert.ToDouble(itemsDataGrid[QtyColumn.Index, e.RowIndex].Value);
                double qty  = sample.GetAmountInSmallestUnit();
                double rest = r_grn.GetOutstandingReturned(pi.ID) - qty;
                if (rest < 0)
                {
                    e.Cancel = true;
                    itemsDataGrid.Rows[e.RowIndex].ErrorText = "Quantity exceed outstanding quantity";
                }
                //itemsDataGrid[OutstandingPOColumn.Index, e.RowIndex].Value = rest;
            }
        }