Пример #1
0
        private void UpdateStockInfo()
        {
            if (m_part.ID == 0)
            {
                return;
            }
            double totalBalance = 0;
            double totalOrder   = 0;
            double totalBook    = 0;

            stockInfokryptonDataGridView2.Rows.Clear();
            IList scis = r_part.GetStockCardInfoList(m_part.ID);

            foreach (StockCardInfo sc in scis)
            {
                int p = stockInfokryptonDataGridView2.Rows.Add();
                stockInfokryptonDataGridView2[warehouseColumn.Index, p].Value  = sc.WAREHOUSE.NAME;
                stockInfokryptonDataGridView2[BookingColumn1.Index, p].Value   = sc.BOOKED;
                stockInfokryptonDataGridView2[orderedColumn.Index, p].Value    = sc.BACKORDER;
                stockInfokryptonDataGridView2[availableColumn1.Index, p].Value = sc.BALANCE;
                stockInfokryptonDataGridView2[unitstockColumn1.Index, p].Value = m_part.UNIT.CODE;
                totalBalance += sc.BALANCE;
                totalOrder   += sc.BACKORDER;
                totalBook    += sc.BOOKED;
            }
            balanceKryptonTextBox.Text   = totalBalance.ToString();
            BackOrderKryptonTextBox.Text = totalOrder.ToString();
            bookedKryptonTextBox.Text    = totalBook.ToString();
            UserSetting.AddNumberToGrid(stockInfokryptonDataGridView2);
            unitkryptonLabel.Text   = m_part.UNIT.CODE;
            unitkryptonLabel18.Text = m_part.UNIT.CODE;
            unitkryptonLabel19.Text = m_part.UNIT.CODE;
        }
Пример #2
0
        private void pricemovkryptonButton1_Click(object sender, EventArgs e)
        {
            try
            {
                pricemovementkryptonDataGridView1.Rows.Clear();
                if (m_part.ID == 0)
                {
                    return;
                }
                IList movs = r_sir.GetSupplierInvoiceItem(m_part.ID);

                foreach (EventItem itm in movs)
                {
                    int r = pricemovementkryptonDataGridView1.Rows.Add();
                    pricemovementkryptonDataGridView1[dateprcmovColumn1.Index, r].Value = itm.EVENT.TRANSACTION_DATE;
                    pricemovementkryptonDataGridView1[codeprcmovColumn2.Index, r].Value = itm.EVENT.CODE;
                    pricemovementkryptonDataGridView1[typeprcmovColumn1.Index, r].Value = itm.STOCK_CARD_ENTRY_TYPE.ToString();
                    pricemovementkryptonDataGridView1[qtyprcmovColumn1.Index, r].Value  = itm.GetAmountInSmallestUnit();
                    pricemovementkryptonDataGridView1[unitprcmovColumn3.Index, r].Value = m_part.UNIT.CODE;
                    switch (itm.STOCK_CARD_ENTRY_TYPE)
                    {
                    case StockCardEntryType.SupplierInvoice:
                        SupplierInvoiceItem sii = (SupplierInvoiceItem)itm;
                        SupplierInvoice     si  = (SupplierInvoice)sii.EVENT;
                        si.SUPPLIER = (Supplier)r_sup.GetById(si.SUPPLIER);
                        pricemovementkryptonDataGridView1[vendorprcmovColumn4.Index, r].Value = si.SUPPLIER.NAME;
                        double c = sii.SUBTOTAL / sii.GetAmountInSmallestUnit();
                        c = r_ccy.ConvertToCurrency(si.CURRENCY, m_part.CURRENCY, c, si.TRANSACTION_DATE);
                        pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = c < 0 ? -c : c;
                        break;

                    case StockCardEntryType.StockTaking:
                        StockTakingItems stk  = (StockTakingItems)itm;
                        StockTaking      stkh = (StockTaking)itm.EVENT;
                        double           p    = stk.TOTAL_AMOUNT / stk.GetAmountInSmallestUnit();
                        p = r_ccy.ConvertToCurrency(stkh.CURRENCY, m_part.CURRENCY, p, stkh.TRANSACTION_DATE);
                        pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = p < 0 ? -p : p;
                        break;

                    case StockCardEntryType.OpeningStock:
                        OpeningStockItem opn  = (OpeningStockItem)itm;
                        OpeningStock     opnh = (OpeningStock)itm.EVENT;
                        double           x    = opn.TOTAL_AMOUNT / opn.GetAmountInSmallestUnit();
                        x = r_ccy.ConvertToCurrency(opnh.CURRENCY, m_part.CURRENCY, x, opnh.TRANSACTION_DATE);
                        pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = x < 0 ? -x : x;
                        break;
                    }
                    pricemovementkryptonDataGridView1[statusMovementColumn.Index, r].Value = itm.EVENT.POSTED.ToString();
                }
                UserSetting.AddNumberToGrid(pricemovementkryptonDataGridView1);
                updatePriceMovement();
            }
            catch (Exception x)
            {
                KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #3
0
        private void findkryptonButton1_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                updateEntity();
                IList result = r_part.FindAllMarkDownSellingPrice(m_marksellingprice);
                partDataGridView1.Rows.Clear();
                m_result = result;
                foreach (Part p in result)
                {
                    p.UNIT          = m_unitDic[p.UNIT.ID];
                    p.PART_GROUP    = m_partGroupDic[p.PART_GROUP.ID];
                    p.PART_CATEGORY = m_partCategoryDic[p.PART_CATEGORY.ID];
                    p.CURRENCY      = m_ccyDic[p.CURRENCY.ID];

                    int r = partDataGridView1.Rows.Add();
                    partDataGridView1[codeColumn.Index, r].Value         = p.CODE;
                    partDataGridView1[nameColumn.Index, r].Value         = p.NAME;
                    partDataGridView1[codeColumn.Index, r].Value         = p.CODE;
                    partDataGridView1[unitColumn.Index, r].Value         = p.UNIT.CODE;
                    partDataGridView1[groupColumn.Index, r].Value        = p.PART_GROUP.CODE;
                    partDataGridView1[categoryColumn.Index, r].Value     = p.PART_CATEGORY.CODE;
                    partDataGridView1[costpriceColumn.Index, r].Value    = p.COST_PRICE;
                    partDataGridView1[sellpriceColumn.Index, r].Value    = p.SELL_PRICE;
                    partDataGridView1[newsellpriceColumn.Index, r].Value = p.NEW_SELL_PRICE;
                    partDataGridView1[ccyColumn.Index, r].Value          = p.CURRENCY.CODE;
                    partDataGridView1.Rows[r].Tag = p;
                }
                foundkryptonLabel12.Text = "Found " + partDataGridView1.Rows.Count + " record(s)";
                UserSetting.AddNumberToGrid(partDataGridView1);
                this.Cursor = Cursors.Default;
            }
            catch (Exception x)
            {
                KryptonMessageBox.Show(x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #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);
        }
 private void transactionkryptonDataGridView_Sorted(object sender, EventArgs e)
 {
     UserSetting.AddNumberToGrid(transactionkryptonDataGridView);
 }
Пример #6
0
 private void partDataGridView1_Sorted(object sender, EventArgs e)
 {
     UserSetting.AddNumberToGrid(partDataGridView1);
 }
Пример #7
0
 private void dataGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     UserSetting.AddNumberToGrid((KryptonDataGridView)sender);
 }
Пример #8
0
 private void formAccessKryptonDataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     UserSetting.AddNumberToGrid(formAccessKryptonDataGridView1);
 }