private void save() { short x = 0; string lSQL = null; string lHeading = null; ADODB.Recordset rs = new ADODB.Recordset(); rs = modRecordSet.cnnDB.Execute("DELETE FROM ftDataItem WHERE (ftDataItem_PersonID = " + modRecordSet.gPersonID + ") AND (ftDataItem_FieldName = '" + Strings.Replace(gField, "'", "''") + "')"); modRecordSet.cnnDB.Execute("DELETE FROM ftData WHERE (ftData_PersonID = " + modRecordSet.gPersonID + ") AND (ftData_FieldName = '" + Strings.Replace(gField, "'", "''") + "')"); for (x = 0; x <= lstFilter.Items.Count - 1; x++) { if (lstFilter.GetItemChecked(x)) { lHeading = lHeading + " OR ''" + gArray[GID.GetItemData(ref lstFilter, ref x), 1] + "''"; lSQL = lSQL + " OR [field] = " + gArray[GID.GetItemData(ref lstFilter, ref x), 0]; modRecordSet.cnnDB.Execute("INSERT INTO ftDataItem (ftDataItem_PersonID, ftDataItem_FieldName, ftDataItem_ID) VALUES (" + modRecordSet.gPersonID + ", '" + Strings.Replace(gField, "'", "''") + "', " + gArray[GID.GetItemData(ref lstFilter, ref x), 0] + ")"); } } if (!string.IsNullOrEmpty(lSQL)) { lSQL = "(" + Strings.Mid(lSQL, 4) + ")"; lHeading = "(" + gHeading + " = " + Strings.Mid(lHeading, 4) + ")"; modRecordSet.cnnDB.Execute("INSERT INTO ftData (ftData_PersonID, ftData_FieldName, ftData_SQL, ftData_Heading) VALUES (" + modRecordSet.gPersonID + ", '" + Strings.Replace(gField, "'", "''") + "', '" + Strings.Replace(lSQL, "'", "''") + "', '" + Strings.Replace(lHeading, "'", "''") + "')"); } }
private void printBarcodePerson() { Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); Scripting.TextStream lStream = default(Scripting.TextStream); string lString = null; string[] lArray = null; string lText = null; short x = 0; short y = 0; for (y = 0; y <= lstPerson.Items.Count - 1; y++) { if (lstPerson.GetItemChecked(y)) { rs.Filter = "PersonID = " + GID.GetItemData(ref lstPerson, ref y); //rs.Filter = "PersonID = " & CLng(lstPerson(y)) lString = rs.Fields("label_textstream").Value; lArray = Strings.Split(lString, Constants.vbCrLf); lString = ""; for (x = 0; x <= Information.UBound(lArray); x++) { lText = lArray[x]; lString = lString + Constants.vbCrLf + doString(ref lText, ref rs); } lStream = fso.OpenTextFile("c:\\aa.txt", Scripting.IOMode.ForWriting, true); lStream.Write(lString); lStream.Close(); lString = "C:\\AA.TXT"; modSpool.SpoolFile(lString, (lblPrinter.Text)); } } }
private void cmdUp_Click(System.Object eventSender, System.EventArgs eventArgs) { short x = 0; int id = 0; if (lstItem.SelectedIndex > 0) { id = Convert.ToInt32(lstItem.SelectedIndex); modRecordSet.cnnDB.Execute("UPDATE GRVTemplateItem SET GRVTemplateItem.GRVTemplateItem_Order = " + lstItem.SelectedIndex + 1 + " WHERE (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID)=" + Convert.ToInt32(cmbTemplate.SelectedIndex) + ") AND ((GRVTemplateItem.GRVTemplateItem_GRVTemplateListID)=" + Convert.ToInt32(lstItem.SelectedIndex - 1) + "));"); modRecordSet.cnnDB.Execute("UPDATE GRVTemplateItem SET GRVTemplateItem.GRVTemplateItem_Order = " + lstItem.SelectedIndex + " WHERE (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID)=" + Convert.ToInt32(cmbTemplate.SelectedIndex) + ") AND ((GRVTemplateItem.GRVTemplateItem_GRVTemplateListID)=" + Convert.ToInt32(lstItem.SelectedIndex) + "));"); for (x = lstItem.SelectedIndex + 1; x <= lstItem.Items.Count - 1; x++) { modRecordSet.cnnDB.Execute("UPDATE GRVTemplateItem SET GRVTemplateItem.GRVTemplateItem_Order = " + x + 1 + " WHERE (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID)=" + Convert.ToInt32(cmbTemplate.SelectedIndex) + ") AND ((GRVTemplateItem.GRVTemplateItem_GRVTemplateListID)=" + GID.GetItemData(ref lstItem, ref x) + "));"); } cmbTemplate_SelectedIndexChanged(cmbTemplate, new System.EventArgs()); for (x = 0; x <= lstItem.Items.Count - 1; x++) { if (GID.GetItemData(ref lstItem, ref x) == id) { lstItem.SelectedIndex = x; lstItem.Focus(); break; // TODO: might not be correct. Was : Exit For } } } }
public void loadItem(ref int id) { int x = 0; ADODB.Recordset rs = default(ADODB.Recordset); int lValue = 0; loading = true; gID = id; rs = modRecordSet.getRS(ref "SELECT DISPLAY_Person.PersonID, DISPLAY_Person.Person_Name, IIf([Person_SecurityBitPOS] Is Null,0,[Person_SecurityBitPOS]) AS [bit] From DISPLAY_Person WHERE (((DISPLAY_Person.PersonID)=" + id + "));"); lValue = rs.Fields("bit").Value; _Label1_2.Text = "Point Of Sale Access Rights for '" + rs.Fields("Person_Name").Value + "'"; rs = modRecordSet.getRS(ref "SELECT SecurityBit.SecurityBit_Value, SecurityBit.SecurityBit_Name From SecurityBit Where (((SecurityBit.SecurityBit_Type) = 0)) ORDER BY SecurityBit.SecurityBitID;"); int m = 0; while (!(rs.EOF)) { m = lstSecurity.Items.Add(new LBI(rs.Fields("SecurityBit_Name").Value, rs.Fields("SecurityBit_Value").Value)); if (rs.Fields("SecurityBit_Value").Value & lValue) { lstSecurity.SetItemChecked(m, true); } else { lstSecurity.SetItemChecked(m, false); } rs.moveNext(); } rs = modRecordSet.getRS(ref "SELECT Channel.ChannelID, Channel.Channel_Name FROM Channel ORDER BY Channel.ChannelID;"); while (!(rs.EOF)) { lstChannel.Items.Add(new LBI(rs.Fields("Channel_Name").Value, rs.Fields("ChannelID").Value)); rs.moveNext(); } rs = modRecordSet.getRS(ref "SELECT PersonChannelLnk.PersonChannelLnk_ChannelID From PersonChannelLnk WHERE (((PersonChannelLnk.PersonChannelLnk_PersonID)=" + gID + "));"); while (!(rs.EOF)) { for (x = 0; x <= lstChannel.Items.Count - 1; x++) { if (GID.GetItemData(ref lstChannel, ref x) == rs.Fields("PersonChannelLnk_ChannelID").Value) { lstChannel.SetItemChecked(x, true); } } rs.moveNext(); } loading = false; loadLanguage(); this.ShowDialog(); }
private void lstFilter_ItemCheck(System.Object eventSender, System.Windows.Forms.ItemCheckEventArgs eventArgs) { if (loading) { return; } short x = 0; x = GID.GetItemData(ref lstFilter, ref lstFilter.SelectedIndex); if (Convert.ToBoolean(gArray[x, 2]) != lstFilter.GetItemChecked(eventArgs.Index)) { gArray[x, 2] = Convert.ToString(lstFilter.GetItemChecked(lstFilter.SelectedIndex)); } }
private void frmPOSSecurity_FormClosed(System.Object eventSender, System.Windows.Forms.FormClosedEventArgs eventArgs) { short x = 0; int bit = 0; for (x = 0; x <= this.lstSecurity.Items.Count - 1; x++) { if (lstSecurity.GetItemChecked(x)) { bit = bit + GID.GetItemData(ref lstSecurity, ref x); } } modRecordSet.cnnDB.Execute("UPDATE Person SET Person.Person_SecurityBitPOS = " + bit + " WHERE (((Person.PersonID)=" + gID + "));"); }
private void cmdProceed_Click(System.Object eventSender, System.EventArgs eventArgs) { string sql = null; ADODB.Recordset rs = default(ADODB.Recordset); if (lstSupplier.SelectedIndex != -1) { sql = "INSERT INTO PurchaseOrder ( PurchaseOrder_SupplierID, PurchaseOrder_DayEndID, PurchaseOrder_PersonID, PurchaseOrder_DateCreated, PurchaseOrder_PurchaseOrderStatusID, PurchaseOrder_Reference, PurchaseOrder_AttentionLine ) "; sql = sql + "SELECT " + GID.GetItemData(ref this.lstSupplier, ref lstSupplier.SelectedIndex) + ", Company.Company_DayEndID, " + modRecordSet.gPersonID + ", Now(), 1, '" + Strings.Format(DateAndTime.Now, "yyyy mmm dd") + " (Blind)', '' FROM Company;"; modRecordSet.cnnDB.Execute(sql, , ADODB.ExecuteOptionEnum.adExecuteNoRecords); rs = modRecordSet.getRS(ref "SELECT Max(PurchaseOrder.PurchaseOrderID) AS id FROM PurchaseOrder;"); this.Close(); My.MyProject.Forms.frmGRV.Create(rs.Fields("id").Value); } }
private void doAction(ref bool ltype) { short x = 0; if (ltype) { modRecordSet.cnnDB.Execute("DELETE GRVTemplateItem.GRVTemplateItem_GRVTemplateID, GRVTemplateItem.GRVTemplateItem_GRVTemplateListID From GRVTemplateItem WHERE (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID)=" + GID.GetItemData(ref cmbTemplate, ref cmbTemplate.SelectedIndex) + ") AND ((GRVTemplateItem.GRVTemplateItem_GRVTemplateListID)=" + Convert.ToInt32(lstItem.SelectedIndex) + "));"); } else { for (x = 0; x <= lstItem.Items.Count - 1; x++) { if (GID.GetItemData(ref lstItem, ref x) == Convert.ToInt32(lstTemplate.SelectedIndex)) { lstItem.SelectedIndex = x; return; } } modRecordSet.cnnDB.Execute("INSERT INTO GRVTemplateItem ( GRVTemplateItem_GRVTemplateID, GRVTemplateItem_GRVTemplateListID, GRVTemplateItem_Order ) VALUES (" + Convert.ToInt32(cmbTemplate.SelectedIndex) + ", " + GID.GetItemData(ref lstTemplate, ref lstTemplate.SelectedIndex) + ", " + lstItem.Items.Count + 1 + ");"); } reorder(); cmbTemplate_SelectedIndexChanged(cmbTemplate, new System.EventArgs()); }
private void printA4Person() { decimal mm = default(decimal); int lline = 0; int i = 0; int lTop = 0; int lHeight = 0; int gOffsetLabel = 0; System.Drawing.Printing.PrintDocument Printer = new System.Drawing.Printing.PrintDocument(); System.Drawing.Printing.PrintDocument lObject = new System.Drawing.Printing.PrintDocument(); int y = 0; ADODB.Recordset rsData = default(ADODB.Recordset); int currentPic = 0; int twipsToMM = 0; int lLeft = 0; int lWidth = 0; short lCol = 0; short lCols = 0; short lRows = 0; short lrow = 0; //Printer.ScaleMode = ScaleModeConstants.vbTwips 'twips //twipsToMM = Printer.ScaleWidth //Printer.ScaleMode = ScaleModeConstants.vbMillimeters 'mm //twipsToMM = twipsToMM / Printer.ScaleWidth //Printer.ScaleMode = ScaleModeConstants.vbTwips 'twips lObject = Printer; string lString1 = null; string lString2 = null; rs.MoveFirst(); rsData = modRecordSet.getRS(ref "SELECT * FROM labelItem INNER JOIN label ON labelItem.labelItem_LabelID = label.labelID Where (((label.labelID) = " + rs.Fields("LabelID").Value + ")) ORDER BY label.labelID, labelItem.labelItem_Line;"); //lLeft = (lObject.Width - (lWidth)) / 2 + (gOffsetLabel * twipsToMM) lLeft = 0; if (rsData.Fields("Label_Rotate").Value) { lWidth = rsData.Fields("label_Height").Value *twipsToMM; lHeight = rsData.Fields("label_Width").Value *twipsToMM; } else { lWidth = rsData.Fields("label_width").Value *twipsToMM; lHeight = rsData.Fields("label_Height").Value *twipsToMM; } lTop = rsData.Fields("label_Top").Value *twipsToMM; //lCols = CDec(Printer.Width / (lWidth + 60)) - 0.49999 //lRows = CDec(Printer.Height / (lHeight + 60)) - 0.49999 for (i = 0; i <= lstPerson.Items.Count - 1; i++) { if (lstPerson.GetItemChecked(i)) { rs.Filter = "PersonID=" + GID.GetItemData(ref lstPerson, ref i); rsData.MoveFirst(); y = 0; if (y < 0) { y = 0; } //lObject.FontName = "Tahoma" rsData.MoveFirst(); if (rsData.RecordCount) { lline = rsData.Fields("labelItem_Line").Value; lLeft = lCol * (lWidth + 60); //lObject.CurrentY = lrow * (lHeight + 60) rsData.MoveFirst(); //y = lObject.CurrentY //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(Me.BackColor) //lObject.Line((lLeft, y) - (lLeft, y + 100)) //lObject.Line((lLeft, y) - (lLeft + 100, y)) //lObject.Line((lLeft + lWidth, y) - (lLeft + lWidth - 100, y)) //lObject.Line((lLeft + lWidth, y) - (lLeft + lWidth, y + 100)) //lObject.Line((lLeft + lWidth, lHeight + y) - (lLeft + lWidth, lHeight + y - 100)) //lObject.Line((lLeft + lWidth, lHeight + y) - (lLeft + lWidth - 100, lHeight + y)) //lObject.Line((lLeft, lHeight + y) - (lLeft, lHeight + y - 100)) //lObject.Line((lLeft, lHeight + y) - (lLeft + 100, lHeight + y)) //lObject.CurrentY = lrow * (lHeight + 60) + lTop //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //y = lObject.CurrentY + 10 while (!(rsData.EOF)) { if (lline != rsData.Fields("labelItem_Line").Value) { // y = lObject.CurrentY + 10 lline = rsData.Fields("labelItem_Line").Value; } switch (Strings.LCase(Strings.Trim(rsData.Fields("labelItem_Field").Value))) { case "blank": break; // lObject.FontSize = rsData.Fields("labelItem_Size").Value // lObject.FontBold = rsData.Fields("labelItem_Bold").Value //' lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White) // lObject.Print(" ") case "line": break; // lObject.Line((15 + lLeft, y) - (lLeft + lWidth, y), System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black)) case "code": switch (rsData.Fields("labelItem_Align").Value) { case 1: break; //printBarcode(lObject, rs.Fields("Person_QuickAccess").Value, lLeft + 90, y) case 2: break; //printBarcode(lObject, rs.Fields("Person_QuickAccess").Value, lLeft + 90, y) default: break; //printBarcode(lObject, rs.Fields("Person_QuickAccess").Value, lLeft, y, lWidth) } break; default: //lObject.FontSize = rsData.Fields("labelItem_Size").Value //lObject.FontBold = rsData.Fields("labelItem_Bold").Value //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White) mm = rsData.Fields("labelItem_Field").Value; lString1 = rs.Fields(mm).Value; switch (rsData.Fields("labelItem_Align").Value) { case 1: break; //lObject.PSet(New Point[](lLeft + 90, y)) //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //lObject.Print(lString1) case 2: break; //lObject.PSet(New Point[](lLeft + lWidth - lObject.TextWidth(lString1) - 90, y)) //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //lObject.Print(lString1) case 3: splitStringA4(ref lObject, ref lWidth, ref lString1, ref lString2); //lObject.PSet(New Point[](CShort(lLeft + (lWidth - lObject.TextWidth(lString1)) / 2), y)) //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //lObject.Print(lString1) //y = lObject.CurrentY + 10 //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White) lString1 = lString2; break; //lObject.PSet(New Point[](CShort(lLeft + (lWidth - lObject.TextWidth(lString1)) / 2), y)) //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //lObject.Print(lString1) default: break; //lObject.PSet(New Point[](CShort(lLeft + (lWidth - lObject.TextWidth(lString1)) / 2), y)) //lObject.ForeColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black) //lObject.Print(lString1) } break; } rsData.moveNext(); } lCol = lCol + 1; if (lCol >= lCols) { lCol = 0; lrow = lrow + 1; //If (lrow + 1) * lHeight > lObject.Height Then //Printer.NewPage() //lrow = -1 //End If } } } } //Printer.EndDoc() }
private string getSQL() { string sql = null; bool gl = false; string lWhere = null; short x = 0; string lString = null; //If 1 = 1 Then lWhere = lWhere & " AND (Sale.Sale_SaleChk=False)" if (chkOutCon.CheckState) { lWhere = lWhere + " AND (Consignment_CompleteSaleID Is Null)"; } if (chkNoCon.CheckState) { lWhere = lWhere + " AND (ConsignmentID Is Null)"; } if (chkRevoke.CheckState) { lWhere = lWhere + " AND (SaleItem_Revoke=True)"; } if (chkReversal.CheckState) { lWhere = lWhere + " AND (SaleItem_Reversal=True)"; } if (chkFC.CheckState) { lWhere = lWhere + " AND (Sale_PaymentType=8)"; } lString = ""; for (x = 0; x <= this.lstChannel.Items.Count - 1; x++) { if (this.lstChannel.GetItemChecked(x)) { lString = lString + " OR Sale_ChannelID=" + GID.GetItemData(ref lstChannel, ref x); } } if (!string.IsNullOrEmpty(lString)) { lString = " AND (" + Strings.Mid(lString, 4) + ")"; lWhere = lWhere + lString; } lString = ""; for (x = 0; x <= this.lstPerson.Items.Count - 1; x++) { if (this.lstPerson.GetItemChecked(x)) { lString = lString + " OR Sale_PersonID=" + GID.GetItemData(ref lstPerson, ref x); } } if (!string.IsNullOrEmpty(lString)) { lString = " AND (" + Strings.Mid(lString, 4) + ")"; lWhere = lWhere + lString; } lString = ""; for (x = 0; x <= this.lstPOS.Items.Count - 1; x++) { if (this.lstPOS.GetItemChecked(x)) { lString = lString + " OR Sale_POSID=" + GID.GetItemData(ref lstPOS, ref x); } } if (!string.IsNullOrEmpty(lString)) { lString = " AND (" + Strings.Mid(lString, 4) + ")"; lWhere = lWhere + lString; } lString = ""; gl = false; for (x = 0; x <= this.lstSaleref.Items.Count - 1; x++) { if (this.lstSaleref.GetItemChecked(x)) { if (x == 0) { lString = lString + " Sale_CardRef <>''"; gl = true; } else if (x == 1) { if (gl == true) { lString = lString + " OR Sale_OrderRef <>''"; } else { lString = lString + " Sale_OrderRef <>''"; gl = true; } } else if (x == 2) { if (gl == true) { lString = lString + " OR Sale_SerialRef <>''"; } else { lString = lString + " Sale_SerialRef <>''"; } } } } if (!string.IsNullOrEmpty(lString)) { lString = " AND (" + Strings.Mid(lString, 2) + ")"; lWhere = lWhere + lString; } if (!string.IsNullOrEmpty(lWhere)) { lWhere = " WHERE " + Strings.Mid(lWhere, 6); } //FROM OLD BO code sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, [Person_FirstName] & ' ' & [Person_LastName] AS PersonName,aPerson1.Person_Comm FROM SaleItem INNER JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment RIGHT JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson1 ON Sale.Sale_PersonID = aPerson1.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID " //added new Mgr field below sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, [Person_FirstName] & ' ' & [Person_LastName] AS PersonName,aPerson.Person_Comm FROM SaleItem INNER JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment RIGHT JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID " //query copy of report SELECT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, [Person_FirstName] & ' ' & [Person_LastName] AS PersonName, aPerson.Person_Comm FROM SaleItem INNER JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment RIGHT JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID WHERE (((Sale.Sale_PosID)=12) AND ((SaleItem.SaleItem_Reversal)=True)); if (chkOutCon.CheckState) { //sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, aPerson.Person_FirstName & ' ' & aPerson.Person_LastName AS PersonName, aPerson.Person_Comm, aPerson1.Person_FirstName & ' ' & aPerson1.Person_LastName AS MgrName FROM (SaleItem INNER JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment INNER JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID) LEFT JOIN aPerson1 ON Sale.Sale_ManagerID = aPerson1.PersonID " sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, aPerson.Person_FirstName & ' ' & aPerson.Person_LastName AS PersonName, aPerson.Person_Comm, aPerson1.Person_FirstName & ' ' & aPerson1.Person_LastName AS MgrName, aPOS1.POS_Name FROM ((SaleItem INNER JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment INNER JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID) LEFT JOIN aPerson1 ON Sale.Sale_ManagerID = aPerson1.PersonID) INNER JOIN aPOS1 ON Sale.Sale_PosID = aPOS1.POSID "; } else { //sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, aPerson.Person_FirstName & ' ' & aPerson.Person_LastName AS PersonName, aPerson.Person_Comm, aPerson1.Person_FirstName & ' ' & aPerson1.Person_LastName AS MgrName FROM (SaleItem RIGHT JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment RIGHT JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID) LEFT JOIN aPerson1 ON Sale.Sale_ManagerID = aPerson1.PersonID " sql = "SELECT DISTINCT Sale.*, aConsignment.*, aCustomer.Customer_InvoiceName, aChannel.Channel_Name, aPerson.Person_FirstName & ' ' & aPerson.Person_LastName AS PersonName, aPerson.Person_Comm, aPerson1.Person_FirstName & ' ' & aPerson1.Person_LastName AS MgrName, aPOS1.POS_Name FROM ((SaleItem RIGHT JOIN ((aChannel INNER JOIN (aCustomer RIGHT JOIN (CustomerTransaction RIGHT JOIN (aConsignment RIGHT JOIN Sale ON aConsignment.Consignment_SaleID = Sale.SaleID) ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON aCustomer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON aChannel.ChannelID = Sale.Sale_ChannelID) INNER JOIN aPerson ON Sale.Sale_PersonID = aPerson.PersonID) ON SaleItem.SaleItem_SaleID = Sale.SaleID) LEFT JOIN aPerson1 ON Sale.Sale_ManagerID = aPerson1.PersonID) INNER JOIN aPOS1 ON Sale.Sale_PosID = aPOS1.POSID "; } sql = sql + lWhere; Debug.Print(sql); return(sql); }
private void doKeyPress(ref short KeyAscii) { int lc = 0; short x = 0; switch (KeyAscii) { case 27: KeyAscii = 0; this.Close(); break; case 13: KeyAscii = 0; if (lstStockItem.SelectedIndex != -1) { lc = CountSelected(ref lstStockItem.Items.Count); if (lc > 0) { if (Interaction.MsgBox("Changes you are about to make will affect : " + lc + " record(s), Do you want to continue?", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.YesNo, "4POS Global Update") == MsgBoxResult.Yes) { modRecordSet.cnnDB.Execute("DELETE * FROM gGlobalUpdate;"); for (x = 0; x <= lstStockItem.Items.Count - 1; x++) { if (lstStockItem.GetSelected(x) == true) { modRecordSet.cnnDB.Execute("INSERT INTO gGlobalUpdate(gStockItemID) VALUES (" + GID.GetItemData(ref lstStockItem, ref x) + ")"); } } } else { modRecordSet.cnnDB.Execute("DELETE * FROM gGlobalUpdate;"); this.Close(); } } else { modRecordSet.cnnDB.Execute("DELETE * FROM gGlobalUpdate;"); } } this.Close(); break; case 65: case 97: for (x = 0; x <= lstStockItem.Items.Count - 1; x++) { lstStockItem.SetSelected(x, true); } break; } }
private void reorder() { short x = 0; for (x = 0; x <= lstItem.Items.Count - 1; x++) { modRecordSet.cnnDB.Execute("UPDATE GRVTemplateItem SET GRVTemplateItem.GRVTemplateItem_Order = " + x + 1 + " WHERE (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID)=" + Convert.ToInt32(cmbTemplate.SelectedIndex) + ") AND ((GRVTemplateItem.GRVTemplateItem_GRVTemplateListID)=" + GID.GetItemData(ref lstItem, ref x) + "));"); } }
private void cmdNext_Click(System.Object eventSender, System.EventArgs eventArgs) { // On Local Error Resume Next string sql = null; ADODB.Recordset rs = default(ADODB.Recordset); switch (gMode) { case mdSupplier: rs = modRecordSet.getRS(ref "SELECT * FROM Supplier WHERE SupplierID = " + GID.GetItemData(ref lstSupplier, ref lstSupplier.SelectedIndex)); lblName.Text = ""; lblRepName.Text = ""; lblRepNumber.Text = ""; gSupplierID = rs.Fields("SupplierID").Value; lblName.Text = rs.Fields("Supplier_Name").Value; lblRepName.Text = rs.Fields("Supplier_RepresentativeName").Value + ""; lblRepNumber.Text = rs.Fields("Supplier_RepresentativeNumber").Value + ""; doMode(ref mdProcess); break; case mdProcess: exitOrder(); break; } }