Esempio n. 1
0
        private void cmdAuto_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            modRecordSet.cnnDB.Execute("DELETE tempOrderGenerate.* From tempOrderGenerate WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");
            modRecordSet.cnnDB.Execute("INSERT INTO tempOrderGenerate ( tempGenerate_StockItemID, tempGenerate_SupplierID, tempGenerate_Quantity, tempGenerate_OnOrder, tempGenerate_Total ) SELECT StockItem.StockItemID, StockItem.StockItem_SupplierID, 0, 0, 0 From StockItem WHERE (((StockItem.StockItem_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((StockItem.StockItem_Discontinued)=0));");
            modRecordSet.cnnDB.Execute("UPDATE WarehouseStockItemLnk INNER JOIN tempOrderGenerate ON WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = tempOrderGenerate.tempGenerate_StockItemID SET tempOrderGenerate.tempGenerate_Quantity = [tempOrderGenerate]![tempGenerate_Quantity]+[WarehouseStockItemLnk]![WarehouseStockItemLnk_Quantity] WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity)>0) AND ((WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID)=1 Or (WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID)=2));");
            modRecordSet.cnnDB.Execute("UPDATE ((PurchaseOrderItem INNER JOIN tempOrderGenerate ON PurchaseOrderItem.PurchaseOrderItem_StockItemID = tempOrderGenerate.tempGenerate_StockItemID) INNER JOIN PurchaseOrder ON (PurchaseOrderItem.PurchaseOrderItem_PurchaseOrderID = PurchaseOrder.PurchaseOrderID) AND (tempOrderGenerate.tempGenerate_SupplierID = PurchaseOrder.PurchaseOrder_SupplierID)) INNER JOIN PurchaseOrderStatus ON PurchaseOrder.PurchaseOrder_PurchaseOrderStatusID = PurchaseOrderStatus.PurchaseOrderStatusID SET tempOrderGenerate.tempGenerate_OnOrder = [tempGenerate_OnOrder]+([PurchaseOrderItem_Quantity]-[PurchaseOrderItem_QuantityDelivered])*[PurchaseOrderItem]![PurchaseOrderItem_PackSize] WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((PurchaseOrderStatus.PurchaseOrderStatus_Complete)=0));");
            modRecordSet.cnnDB.Execute("UPDATE Company, tempOrderGenerate SET tempOrderGenerate.tempGenerate_OnOrder = 0 WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");

            modRecordSet.cnnDB.Execute("UPDATE tempOrderGenerate INNER JOIN StockItem ON (StockItem.StockItem_SupplierID = tempOrderGenerate.tempGenerate_SupplierID) AND (tempOrderGenerate.tempGenerate_StockItemID = StockItem.StockItemID) SET tempOrderGenerate.tempGenerate_Total = [StockItem_MinimumStock]-[tempGenerate_Quantity]-[tempGenerate_OnOrder] WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");

            modRecordSet.cnnDB.Execute("DELETE tempOrderGenerate.* From tempOrderGenerate WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((tempOrderGenerate.tempGenerate_Total)<1));");

            modRecordSet.cnnDB.Execute("DELETE FROM TempOrderItem WHERE TempOrderItem_SupplierID = " + adoPrimaryRS.Fields("SupplierID").Value);
            modRecordSet.cnnDB.Execute("DELETE FROM TempOrder WHERE  TempOrder_SupplierID = " + adoPrimaryRS.Fields("SupplierID").Value);

            modRecordSet.cnnDB.Execute("INSERT INTO TempOrder ( TempOrder_SupplierID, TempOrder_DayEndID, TempOrder_DateCreated, TempOrder_Reference, TempOrder_AttentionLine ) SELECT Supplier.SupplierID, Company.Company_DayEndID, Now(), '" + Strings.Format(DateAndTime.Now, "dd mmm\", \"yyyy") + "', Supplier.Supplier_OrderAttentionLine From Supplier, Company WHERE (((Supplier.SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");

            //cnnDB.Execute "INSERT INTO TempOrderItem ( TempOrderItem_SupplierID, TempOrderItem_StockItemID, TempOrderItem_PackSize, TempOrderItem_QuantityRequired, TempOrderItem_Quantity ) SELECT tempOrderGenerate.tempGenerate_SupplierID, tempOrderGenerate.tempGenerate_StockItemID, 1 AS Expr1, tempOrderGenerate.tempGenerate_Total, 0 AS Expr2 From tempOrderGenerate WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" & adoPrimaryRS("SupplierID") & "));"
            modRecordSet.cnnDB.Execute("INSERT INTO TempOrderItem ( TempOrderItem_SupplierID, TempOrderItem_StockItemID, TempOrderItem_PackSize, TempOrderItem_QuantityRequired, TempOrderItem_Quantity, TempOrderItem_ContentCost ) SELECT tempOrderGenerate.tempGenerate_SupplierID, tempOrderGenerate.tempGenerate_StockItemID, 1 AS Expr1, tempOrderGenerate.tempGenerate_Total, 0 AS Expr2, StockItem.StockItem_ListCost FROM tempOrderGenerate INNER JOIN StockItem ON tempOrderGenerate.tempGenerate_StockItemID = StockItem.StockItemID WHERE (((tempOrderGenerate.tempGenerate_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");
            modRecordSet.cnnDB.Execute("DELETE TempOrderItem.* FROM TempOrderItem INNER JOIN StockItem ON TempOrderItem.TempOrderItem_StockItemID = StockItem.StockItemID WHERE (((TempOrderItem.TempOrderItem_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((StockItem.StockItem_OrderQuantity)=0)) OR (((TempOrderItem.TempOrderItem_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + ") AND ((StockItem.StockItem_OrderRounding)=0));");

            modRecordSet.cnnDB.Execute("UPDATE TempOrderItem INNER JOIN StockItem ON TempOrderItem.TempOrderItem_StockItemID = StockItem.StockItemID SET TempOrderItem.TempOrderItem_QuantityRequired = CInt([TempOrderItem_QuantityRequired]/([StockItem_OrderQuantity]*[StockItem_OrderRounding])+0.49)*[StockItem_OrderQuantity]*[StockItem_OrderRounding] WHERE (((TempOrderItem.TempOrderItem_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");
            modRecordSet.cnnDB.Execute("UPDATE TempOrderItem INNER JOIN StockItem ON TempOrderItem.TempOrderItem_StockItemID = StockItem.StockItemID SET TempOrderItem.TempOrderItem_Quantity = CInt(([TempOrderItem_QuantityRequired]+([StockItem_OrderQuantity]-1)/2)/[StockItem_OrderQuantity]), TempOrderItem.TempOrderItem_PackSize = [StockItem]![StockItem_OrderQuantity] WHERE (((TempOrderItem.TempOrderItem_SupplierID)=" + adoPrimaryRS.Fields("SupplierID").Value + "));");
            frmOrderItem form = new frmOrderItem();
            form.Show();
            if (this.Visible) {
                cmdEdit_Enabled();
            } else {
                this.Close();
            }
        }
Esempio n. 2
0
        private void cmdBlank_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            modRecordSet.cnnDB.Execute("DELETE FROM TempOrderItem WHERE TempOrderItem_SupplierID = " + DataList1.BoundText);
            modRecordSet.cnnDB.Execute("DELETE FROM TempOrder WHERE  TempOrder_SupplierID = " + DataList1.BoundText);

            modRecordSet.cnnDB.Execute("INSERT INTO TempOrder ( TempOrder_SupplierID, TempOrder_DayEndID, TempOrder_DateCreated, TempOrder_Reference, TempOrder_AttentionLine ) SELECT Supplier.SupplierID, Company.Company_DayEndID, Now(), '" + Strings.Format(DateAndTime.Now, "dd mmm\", \"yyyy") + "', Supplier.Supplier_OrderAttentionLine From Supplier, Company WHERE (((Supplier.SupplierID)=" + DataList1.BoundText + "));");
            frmOrderItem form2 = new frmOrderItem();
            form2.Show();
            if (this.Visible) {
                cmdEdit_Enabled();
            } else {
                this.Close();
            }
        }
Esempio n. 3
0
 private void cmdEdit_Click(System.Object eventSender, System.EventArgs eventArgs)
 {
     frmOrderItem form = new frmOrderItem();
     form.Show();
     if (this.Visible) {
         cmdEdit_Enabled();
     } else {
         this.Close();
     }
 }