Пример #1
0
 private void btnDeleteQuatity_Click(object sender, RoutedEventArgs e)
 {
     if (dtGrid.Rows.Count > 0)
     {
         string InventoryID = GridVoucherInventory.GetFocusedRowCellValue(COL_InventoryID).ToString();
         int    n           = BLVoucher.GetCurrentRowIndex(GridVoucherInventory, "InventoryID");
         int    value_Old   = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_Quantity));
         int    stock_Old   = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_InStock));
         if (value_Old > 1)
         {
             GridVoucherInventory.SetCellValue(n, "Quantity", value_Old - 1);
             GridVoucherInventory.SetCellValue(n, "InStock", stock_Old + 1);
             CalAmountGrid(n);
         }
         else if (value_Old == 1)
         {
             GridVoucherInventory.DeleteRowFocusEvent();
         }
         CalAmount();
         btnSave.IsEnabled = true;
     }
     if (GridVoucherInventory.VisibleRowCount == 0)
     {
         btnAddQuatity.IsEnabled    = false;
         btnDeleteQuatity.IsEnabled = false;
         btnAdd10Quatity.IsEnabled  = false;
     }
 }
Пример #2
0
        private void CallAmount()
        {
            object oPrice    = GridVoucherInventory.GetFocusedRowCellValue(COL_Price);
            object oVAT      = GridVoucherInventory.GetFocusedRowCellValue(COL_VAT);
            object oDiscount = GridVoucherInventory.GetFocusedRowCellValue(COL_Discount);
            object oQuantity = GridVoucherInventory.GetFocusedRowCellValue(COL_Quantity);
            object oAmount   = L3ConvertType.Number(oQuantity) * L3ConvertType.Number(oPrice) * (1 - L3ConvertType.Number(oDiscount) + L3ConvertType.Number(oVAT));

            GridVoucherInventory.SetFocusedRowCellValue(COL_Amount, oAmount);
        }