private void setup() { ADODB.Recordset rs = default(ADODB.Recordset); short x = 0; rs = modReport.getRSreport(ref "SELECT Link.Link_PersonID From Link WHERE (((Link.Link_PersonID)=" + modRecordSet.gPersonID + "));"); if (rs.BOF | rs.EOF) { modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 1, 1, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 2, 1, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 1, 2, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 2, 2, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 1, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 2, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 3, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 4, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 5, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 6, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 7, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 8, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 9, 3, " + modRecordSet.gPersonID + ", '', '';"); modReport.cnnDBreport.Execute("INSERT INTO link ( LinkID, Link_SectionID, Link_PersonID, Link_Name, Link_SQL ) SELECT 10, 3, " + modRecordSet.gPersonID + ", '', '';"); } rs = modReport.getRSreport(ref "SELECT Link.LinkID, Link.Link_Name From Link WHERE (((Link.Link_SectionID)=3) AND ((Link.Link_PersonID)=" + modRecordSet.gPersonID + "));"); while (!(rs.EOF)) { lblItem[rs.Fields("LinkID").Value].Text = rs.Fields("Link_Name").Value; rs.MoveNext(); } }
private void DataList1_MouseDown(System.Object eventSender, MouseEventArgs eventArgs) { object mnuHand = null; object grpDelete = null; //* ADODB.Recordset rs = default(ADODB.Recordset); // ERROR: Not supported in C#: OnErrorStatement if (!string.IsNullOrEmpty(DataList1.BoundText)) { rs = modRecordSet.getRS(ref "SELECT ReportGroup_Name FROM ReportGroup WHERE ReportID =" + Conversion.Val(DataList1.BoundText)); if (Strings.UCase(Strings.Mid(rs.Fields("ReportGroup_Name").Value, 1, 8)) == "HANDHELD") { //UPGRADE_WARNING: Couldn't resolve default property of object grpDelete. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' grpDelete = Strings.Trim(rs.Fields("ReportGroup_Name").Value); if (eventArgs.Button == 2) { //UPGRADE_ISSUE: Form method frmReportGroupList.PopupMenu was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"' //Call PopupMenu(mnuHand) return; } } } //* }
private void frmGRVblind_Load(System.Object eventSender, System.EventArgs eventArgs) { loading = true; frmMode.AddRange(new GroupBox[] { _frmMode_0, _frmMode_1 }); ADODB.Recordset rs = default(ADODB.Recordset); short x = 0; short lQuantity = 0; short lDepositQuantity = 0; decimal lCost = default(decimal); decimal lActualCost = default(decimal); decimal lDepositUnit = default(decimal); decimal lDepositPack = default(decimal); rs = modRecordSet.getRS(ref "SELECT * FROM Supplier WHERE Supplier_Disabled = 0 ORDER BY Supplier.Supplier_Name"); this.lstSupplier.Items.Clear(); while (!(rs.EOF)) { lstSupplier.Items.Add(new LBI(rs.Fields("Supplier_Name").Value + "", rs.Fields("SupplierID").Value)); rs.MoveNext(); } lstSupplier.SelectedIndex = 0; loadLanguage(); loading = false; doMode(ref mdSupplier); }
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; } }
private void cmdSelectChild_Click(System.Object eventSender, System.EventArgs eventArgs) { int lID = 0; ADODB.Recordset rs = default(ADODB.Recordset); lID = 0; lID = My.MyProject.Forms.frmStockList.getItem(); if (lID != 0) { rs = modRecordSet.getRS(ref "SELECT StockItem.StockItemID, StockItem.StockItem_Name, PackSize.PackSize_Volume FROM StockItem INNER JOIN PackSize ON StockItem.StockItem_PackSizeID = PackSize.PackSizeID WHERE (((StockItem.StockItemID)=" + lID + "));"); if (rs.RecordCount) { lblStockItemB.Text = rs.Fields("StockItem_Name").Value; lblStockItemB.Tag = rs.Fields("StockItemID").Value; txtQtyB.Text = Strings.FormatNumber(Convert.ToDecimal(txtPrice.Text) / (rs.Fields("PackSize_Volume").Value == 0 ? 1 : rs.Fields("PackSize_Volume").Value), 2); txtPriceB.Text = Strings.FormatNumber(txtPrice.Text, 4); } else { // MsgBox "Insufficient Qty!" // Exit Sub } // } }
public void loadItem(ref int id) { ADODB.Recordset rs = default(ADODB.Recordset); string sql = null; short x = 0; gID = id; rs = modRecordSet.getRS(ref "SELECT StockItem_Name FROM StockItem WHERE StockItemID = " + gID); if (rs.EOF | rs.EOF) { } else { lblHeading.Text = rs.Fields("StockItem_Name").Value; } sql = "INSERT INTO Catalogue ( Catalogue_StockItemID, Catalogue_Quantity, Catalogue_Barcode, Catalogue_Deposit, Catalogue_Content, Catalogue_Disabled ) "; sql = sql + "SELECT theJoin.StockItemID, theJoin.ShrinkItem_Quantity, 'CODE' AS Expr1, 0 AS deposit, 0 AS content, 0 AS disabled FROM [SELECT StockItem.StockItemID, ShrinkItem.ShrinkItem_Quantity FROM ShrinkItem INNER JOIN "; sql = sql + "StockItem ON ShrinkItem.ShrinkItem_ShrinkID = StockItem.StockItem_ShrinkID]. AS theJoin LEFT JOIN Catalogue ON (theJoin.ShrinkItem_Quantity = Catalogue.Catalogue_Quantity) AND (theJoin.StockItemID = Catalogue.Catalogue_StockItemID) "; sql = sql + "WHERE (((theJoin.StockItemID)=" + id + ") AND ((Catalogue.Catalogue_StockItemID) Is Null));"; modRecordSet.cnnDB.Execute(sql); rs = modRecordSet.getRS(ref "SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode, Catalogue.Catalogue_Deposit, Catalogue.Catalogue_Content, Catalogue.Catalogue_Disabled, ShrinkItem.ShrinkItem_Code FROM Catalogue INNER JOIN (StockItem INNER JOIN ShrinkItem ON StockItem.StockItem_ShrinkID = ShrinkItem.ShrinkItem_ShrinkID) ON (ShrinkItem.ShrinkItem_Quantity = Catalogue.Catalogue_Quantity) AND (Catalogue.Catalogue_StockItemID = StockItem.StockItemID) Where (((Catalogue.Catalogue_StockItemID) = " + gID + ")) ORDER BY Catalogue.Catalogue_Quantity;"); //Set rs = getRS("SELECT Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode, Catalogue.Catalogue_Disabled From Catalogue Where (((Catalogue.Catalogue_StockItemID) = " & gID & ")) ORDER BY Catalogue.Catalogue_Quantity;") //For x = 1 To lblBarcode.Count - 1 //lblBarcode.Unload(x) //txtBarcode.Unload(x) //chkBarcode.Unload(x) //Next x = -1; while (!(rs.EOF)) { x = x + 1; if (x) { //txtBarcode.Load(x) _txtBarcode_0.Top = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_txtBarcode_0.Top, false) + sizeConvertors.pixelToTwips(_txtBarcode_0.Height, false) + 30, false); _txtBarcode_0.Visible = true; _txtBarcode_0.TabIndex = _txtBarcode_0.TabIndex + 1; //lblBarcode.Load(x) _lblBarcode_0.Top = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_txtBarcode_0.Top, false) + sizeConvertors.pixelToTwips(_txtBarcode_0.Height, false) + 60, false); _lblBarcode_0.Visible = true; _lblBarcode_0.BringToFront(); //chkBarcode.Load(x) _chkBarcode_0.Top = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_txtBarcode_0.Top, false) + sizeConvertors.pixelToTwips(_txtBarcode_0.Height, false) + 90, false); _chkBarcode_0.Visible = true; } _lblBarcode_0.Text = rs.Fields("Catalogue_Quantity").Value; _txtBarcode_0.Text = rs.Fields("Catalogue_Barcode").Value; _txtBarcode_0.Tag = _txtBarcode_0.Text; _chkBarcode_0.CheckState = System.Math.Abs(Convert.ToInt16(rs.Fields("Catalogue_Disabled").Value)); _chkBarcode_0.Tag = _chkBarcode_0.CheckState; rs.MoveNext(); } Shape1.Height = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_lblBarcode_0.Top, false) + sizeConvertors.pixelToTwips(_lblBarcode_0.Height, false) + 240 - sizeConvertors.pixelToTwips(Shape1.Top, false), false); Height = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(Shape1.Top, false) + sizeConvertors.pixelToTwips(Shape1.Height, false) + 560, false); }
private void cmdClose_Click(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); bool bCashless = false; if (gID & txtFloat[13].Enabled == true) { rs = modRecordSet.getRS(ref "SELECT SUM(CustomerTransaction.CustomerTransaction_Amount) As sumTran, SUM(CustomerTransaction.CustomerTransaction_Allocated) As sumAlloc From CustomerTransaction WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + gID + "));"); if (rs.RecordCount > 0) { if (System.Math.Round((Information.IsDBNull(rs.Fields("sumTran").Value) ? 0 : rs.Fields("sumTran").Value) - (Information.IsDBNull(rs.Fields("sumAlloc").Value) ? 0 : rs.Fields("sumAlloc").Value), 2) != System.Math.Round(Convert.ToDecimal(txtFloat[13].Text) + Convert.ToDecimal(txtFloat[14].Text) + Convert.ToDecimal(txtFloat[15].Text) + Convert.ToDecimal(txtFloat[16].Text) + Convert.ToDecimal(txtFloat[17].Text) + Convert.ToDecimal(txtFloat[18].Text), 2)) { Interaction.MsgBox("Aging does not match with total Balance! " + (Information.IsDBNull(rs.Fields("sumTran").Value) ? 0 : rs.Fields("sumTran").Value) - (Information.IsDBNull(rs.Fields("sumAlloc").Value) ? 0 : rs.Fields("sumAlloc").Value), MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, _4PosBackOffice.NET.My.MyProject.Application.Info.Title); modUtilities.MyGotFocusNumeric(ref _txtFloat_13); _txtFloat_13.Focus(); return; } } } rs = modRecordSet.getRS(ref "Select Company_CashLess FROM Company;"); if (rs.RecordCount > 0) { bCashless = rs.Fields("Company_CashLess").Value; } if (bCashless == true) { if (gID) { rs = modRecordSet.getRS(ref "Select Customer_InvoiceName FROM Customer WHERE Customer_InvoiceName = '" + _txtFields_2.Text + "' AND CustomerID <> " + gID + ";"); if (rs.RecordCount > 0) { Interaction.MsgBox("Customer [ " + _txtFields_2.Text + " ] as an Invoice Name already exist.", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, _4PosBackOffice.NET.My.MyProject.Application.Info.Title); return; } } else { rs = modRecordSet.getRS(ref "Select Customer_InvoiceName FROM Customer WHERE Customer_InvoiceName = '" + _txtFields_2.Text + "'"); if (rs.RecordCount > 0) { Interaction.MsgBox("Customer [ " + _txtFields_2.Text + " ] as an Invoice Name already exist.", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, _4PosBackOffice.NET.My.MyProject.Application.Info.Title); return; } } } cmdClose.Focus(); System.Windows.Forms.Application.DoEvents(); // update if (update_Renamed()) { this.Close(); } }
private void chkStockItem_CheckStateChanged(System.Object eventSender, System.EventArgs eventArgs) { int lID = 0; ADODB.Recordset rs = default(ADODB.Recordset); if (chkStockItem.CheckState) { for (lID = 0; lID <= 7; lID++) { this.txtFloat[lID].Enabled = false; this.txtFloat[lID].Text = "0.00"; } if (!string.IsNullOrEmpty(chkStockItem.Tag)) { lID = Convert.ToInt32(chkStockItem.Tag); } else { lID = My.MyProject.Forms.frmStockList.getItem(); } if (lID == 0) { chkStockItem.CheckState = System.Windows.Forms.CheckState.Unchecked; } else { this._txtFields_1.Text = Convert.ToString(lID); rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + lID); if (rs.RecordCount) { lblStockitem.Text = rs.Fields("StockItem_Name").Value; rs.Close(); rs = modRecordSet.getRS(ref "SELECT StockItem.StockItem_DepositID, CatalogueChannelLnk.CatalogueChannelLnk_ChannelID, CatalogueChannelLnk.CatalogueChannelLnk_Price FROM CatalogueChannelLnk INNER JOIN StockItem ON CatalogueChannelLnk.CatalogueChannelLnk_StockItemID = StockItem.StockItemID WHERE (CatalogueChannelLnk.CatalogueChannelLnk_StockItemID = " + lID + ") AND (CatalogueChannelLnk.CatalogueChannelLnk_Quantity = " + this._txtInteger_0.Text + ") AND CatalogueChannelLnk.CatalogueChannelLnk_ChannelID <> 9"); while (!(rs.EOF)) { txtFloat[rs.Fields("CatalogueChannelLnk_ChannelID").Value - 1].Text = Convert.ToString(rs.Fields("CatalogueChannelLnk_Price").Value * 100); txtFloat_Leave(txtFloat[rs.Fields("CatalogueChannelLnk_ChannelID").Value - 1], new System.EventArgs()); rs.moveNext(); } } } } else { this._txtFields_1.Text = Convert.ToString(0); lblStockitem.Text = "[No Stock Item ...]"; this._txtFloat_0.Enabled = true; this._txtFloat_1.Enabled = true; this._txtFloat_2.Enabled = true; this.txtFloat[3].Enabled = true; this.txtFloat[4].Enabled = true; this.txtFloat[5].Enabled = true; this.txtFloat[6].Enabled = true; this.txtFloat[7].Enabled = true; } }
//Private Sub Label3_Click() // Dim rs As Recordset // Set rs = getRS("SELECT * FROM aTransactionItem") // If rs.RecordCount = 0 Then // rs.save gMasterPath & "Data\aTransactionItem.rs", adPersistADTG // End If //End Sub public bool loadDB(ref string[] arrComp) { bool functionReturnValue = false; bool loadData = false; bool loading = false; string gHeading = null; string gFieldName = null; int gFieldID = 0; string gField = null; string lName = null; int iret = 0; int lHandle = 0; ADODB.Recordset rs = default(ADODB.Recordset); Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); string lFile = null; //Dim rs As ADODB.Recordset string lSQL = null; int x = 0; string lID = null; gField = lName; rs = modRecordSet.getRS(ref "SELECT * From ftConstruct WHERE (ftConstruct_Name = '" + Strings.Replace(lName, "'", "''") + "')"); gFieldID = rs.Fields("ftConstruct_FieldID").Value; gFieldName = rs.Fields("ftConstruct_FieldName").Value; gHeading = rs.Fields("ftConstruct_DisplayName").Value; lSQL = rs.Fields("ftConstruct_SQL").Value; rs.Close(); rs = modRecordSet.getRS(ref lSQL); //Display the list of Titles in the DataCombo loading = true; loadData = false; loadDBStr = false; if (getMasterDB()) { loadCompanies(); this.ShowDialog(); functionReturnValue = loadDBStr; //If Me.lvLocation.SelectedItem.SubItems(2) = "" Then //Else // loadDB = Me.lvLocation.SelectedItem.SubItems(2) // Unload Me //End If } else { Interaction.MsgBox("System could not find Master Database." + Constants.vbCrLf + Constants.vbCrLf + "Please restart this application", MsgBoxStyle.Information, "Company Select"); functionReturnValue = false; this.Close(); } return(functionReturnValue); }
private void GetData() { string sql = null; string lFilter = null; ADODB.Recordset rs = default(ADODB.Recordset); System.Windows.Forms.ListViewItem lvItem = null; sql = "SELECT TOP 100 PERCENT StockItem.StockItemID, StockItem.StockItem_Name, StockItem.StockItem_MinimumStock, StockItem.StockItem_OrderQuantity, StockItem.StockItem_OrderRounding, StockItem.StockItem_Quantity, StockItem.StockItem_ListCost, MinMaxStockItemLnk.MinMaxStockItemLnk_Minimum, MinMaxStockItemLnk.MinMaxStockItemLnk_Disabled, MinMaxStockItemLnk.MinMaxStockItemLnk_Average FROM MinMaxStockItemLnk INNER JOIN StockItem ON MinMaxStockItemLnk.MinMaxStockItemLnk_StockItemID = StockItem.StockItemID "; lFilter = My.MyProject.Forms.frmOrderWizardFilter.gFilterSQL; if (string.IsNullOrEmpty(lFilter)) { lFilter = " WHERE "; } else { lFilter = lFilter + " AND "; } lFilter = lFilter + "(MinMaxStockItemLnk.MinMaxStockItemLnk_MinMaxID = 1) AND (StockItem_Discontinued = 0) AND MinMaxStockItemLnk.MinMaxStockItemLnk_Disabled=0 "; sql = sql + lFilter; sql = sql + " ORDER BY StockItem.StockItem_Name"; rs = modRecordSet.getRS(ref sql); lvData.Items.Clear(); while (!(rs.EOF)) { lvItem = lvData.Items.Add("K" + rs.Fields("StockItemID").Value, rs.Fields("StockItem_Name").Value, ""); lvItem.Checked = rs.Fields("MinMaxStockItemLnk_Disabled").Value; if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = Strings.FormatNumber(rs.Fields("StockItem_ListCost").Value, 2); } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("StockItem_ListCost").Value, 2))); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("StockItem_Quantity").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("StockItem_Quantity").Value)); } if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = rs.Fields("StockItem_OrderRounding").Value + "x" + rs.Fields("StockItem_OrderQuantity").Value; } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("StockItem_OrderRounding").Value + "x" + rs.Fields("StockItem_OrderQuantity").Value)); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = rs.Fields("StockItem_MinimumStock").Value; } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("StockItem_MinimumStock").Value)); } if (lvItem.SubItems.Count > 5) { lvItem.SubItems[5].Text = rs.Fields("MinMaxStockItemLnk_Minimum").Value; } else { lvItem.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("MinMaxStockItemLnk_Minimum").Value)); } if (lvItem.SubItems.Count > 6) { lvItem.SubItems[6].Text = Strings.FormatNumber(rs.Fields("MinMaxStockItemLnk_Average").Value, 4); } else { lvItem.SubItems.Insert(6, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("MinMaxStockItemLnk_Average").Value, 4))); } rs.moveNext(); } }
public void DeleteBlankID() { ADODB.Recordset rj = default(ADODB.Recordset); ADODB.Recordset rs = default(ADODB.Recordset); //UPGRADE_NOTE: Val was upgraded to Val_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' string Val_Renamed = null; Scripting.FileSystemObject oFSO = new Scripting.FileSystemObject(); //cnnDB.Execute "UPDATE " & st_Name & " SET HandHeldID = 0 WHERE Handheld_Barcode = " & vbNullString rj = modRecordSet.getRS(ref "SELECT * FROM " + st_Name + " WHERE HandHeldID = 0"); short i = 0; short j = 0; if (rj.RecordCount > 0) { Interaction.MsgBox("CSV file has missing Barcodes, please verify them.", MsgBoxStyle.ApplicationModal + MsgBoxStyle.Information + MsgBoxStyle.OkOnly, _4PosBackOffice.NET.My.MyProject.Application.Info.Title); //fill test array SaveArrayAsCSVFile.dChrom = new string[rj.RecordCount, 2]; for (i = 0; i <= rj.RecordCount - 1; i++) { for (j = 0; j <= 1; j++) { if (j == 0) { SaveArrayAsCSVFile.dChrom[i, j] = rj.Fields("Handheld_Barcode").Value; } else { SaveArrayAsCSVFile.dChrom[i, j] = rj.Fields("Quantity").Value; } } rj.moveNext(); } if (oFSO.FolderExists("C:\\temp\\")) { } else { oFSO.CreateFolder("C:\\temp\\"); } SaveArrayAsCSVFile.SaveAsCSV(SaveArrayAsCSVFile.dChrom, "C:\\temp\\" + st_Name + "_Missing.csv"); //App.Path & "\temp\" & st_Name & "_Missing.csv" //Set rs = getRS("SELECT Catalogue_StockItemID FROM Catalogue WHERE Catalogue_Barcode = '" & rj("Handheld_Barcode") & "'") //If rs.RecordCount > 0 Then cnnDB.Execute "UPDATE " & st_Name & " SET HandHeldID= " & rs("Catalogue_StockItemID") & " WHERE Handheld_Barcode = '" & rj("Handheld_Barcode") & "'" modRecordSet.cnnDB.Execute("DELETE from " + st_Name + " WHERE HandHeldID = 0"); Interaction.MsgBox("CSV file has been as C:\\temp\\" + st_Name + "_Missing.csv"); } //MsgBox "File was extracted and exported succesfully", vbApplicationModal + vbInformation + vbOKOnly, App.title }
private void txtPassword_KeyPress(System.Object eventSender, System.Windows.Forms.KeyPressEventArgs eventArgs) { short KeyAscii = Strings.Asc(eventArgs.KeyChar); ADODB.Recordset rs = default(ADODB.Recordset); slocalOR = false; // ERROR: Not supported in C#: OnErrorStatement switch (KeyAscii) { case 13: //Dim user As user KeyAscii = 0; rs = modRecordSet.getRS(ref "SELECT * FROM Person WHERE (Person_QuickAccess = '" + Strings.Replace(this.txtPassword.Text, "'", "''") + "')"); if (rs.BOF | rs.EOF) { lblError.Text = "Invalid Security Code!"; txtPassword.SelectionStart = 0; txtPassword.SelectionLength = 999; goto EventExitSub; } else { //MsgBox "Login 1" if (Convert.ToInt32(rs.Fields("Person_SecurityBit").Value + "0")) { if (8192 & rs.Fields("Person_SecurityBit").Value) { slocalOR = true; slocalMgrID = rs.Fields("PersonID").Value; this.Close(); } else { lblError.Text = "Call Your Supervisor!"; txtPassword.SelectionStart = 0; txtPassword.SelectionLength = 999; goto EventExitSub; } } } break; case 27: KeyAscii = 0; this.Close(); break; } EventExitSub: eventArgs.KeyChar = Strings.Chr(KeyAscii); if (KeyAscii == 0) { eventArgs.Handled = true; } }
private void doSearch(ref string sq1) { ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref sq1); while (rs.EOF == false) { lstStockItem.Items.Add(new LBI(rs.Fields("StockItem_Name").Value, rs.Fields("StockItemID").Value)); rs.MoveNext(); } }
private void cmbTemplate_SelectedIndexChanged(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "SELECT GRVTemplateList.GRVTemplateListID, GRVTemplateList.GRVTemplateList_Name FROM GRVTemplateItem INNER JOIN GRVTemplateList ON GRVTemplateItem.GRVTemplateItem_GRVTemplateListID = GRVTemplateList.GRVTemplateListID Where (((GRVTemplateItem.GRVTemplateItem_GRVTemplateID) = " + Convert.ToInt32(cmbTemplate.SelectedIndex) + ")) ORDER BY GRVTemplateItem.GRVTemplateItem_Order;"); lstItem.Items.Clear(); while (!(rs.EOF)) { lstItem.Items.Add(new LBI(rs.Fields("GRVTemplateList_Name").Value, rs.Fields("GRVTemplateListID").Value)); rs.moveNext(); } }
private void getNamespace() { ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rj = default(ADODB.Recordset); blHandHeld = false; //Initialize for StockGroup handheld rs = modRecordSet.getRS(ref "SELECT StockGroup_Name FROM StockGroup WHERE StockGroupID =" + gID); if (Strings.UCase(Strings.Mid(rs.Fields("StockGroup_Name").Value, 1, 8)) == "HANDHELD") { blHandHeld = true; modApplication.stTableName = rs.Fields("StockGroup_Name").Value; //Set adoPrimaryRS = getRS("SELECT StockItem.StockItem_Name, " & stTableName & ".Quantity, StockItem.StockItem_Quantity," & stTableName & ".HandHeldID, StockTake.StockTake_Quantity, StockTake.StockTake_StockItemID FROM ((" & stTableName & " INNER JOIN StockItem ON " & stTableName & ".HandHeldID = StockItem.StockItemID) INNER JOIN StockGroup ON StockItem.StockItem_StockGroupID = StockGroup.StockGroupID) INNER JOIN (StockTake INNER JOIN Warehouse ON StockTake.StockTake_WarehouseID = Warehouse.WarehouseID) ON StockItem.StockItemID = StockTake.StockTake_StockItemID Where (((StockGroup.StockGroupID) < " & gID & ") And ((Warehouse.WarehouseID) = 2) And ((StockItem.StockItem_Disabled) = False) And ((StockItem.StockItem_Discontinued) = False)) ORDER BY StockItem.StockItem_Name") //Multi Warehouse change adoPrimaryRS = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Name, " + modApplication.stTableName + ".Quantity, StockItem.StockItem_Quantity," + modApplication.stTableName + ".HandHeldID, StockTake.StockTake_Quantity, StockTake.StockTake_StockItemID FROM ((" + modApplication.stTableName + " INNER JOIN StockItem ON " + modApplication.stTableName + ".HandHeldID = StockItem.StockItemID) INNER JOIN StockGroup ON StockItem.StockItem_StockGroupID = StockGroup.StockGroupID) INNER JOIN (StockTake INNER JOIN Warehouse ON StockTake.StockTake_WarehouseID = Warehouse.WarehouseID) ON StockItem.StockItemID = StockTake.StockTake_StockItemID Where (((StockGroup.StockGroupID) < " + gID + ") And ((Warehouse.WarehouseID) = " + lMWNo + ") And ((StockItem.StockItem_Disabled) = False) And ((StockItem.StockItem_Discontinued) = False)) ORDER BY StockItem.StockItem_Name"); } else { //Multi Warehouse change //Set adoPrimaryRS = getRS("SELECT StockItem.StockItem_Name, StockTake.StockTake_Quantity, StockTake.StockTake_StockItemID, StockTake.StockTake_WarehouseID, StockItem.StockItem_Quantity FROM (StockTake INNER JOIN StockItem ON StockTake.StockTake_StockItemID = StockItem.StockItemID) INNER JOIN StockGroup ON StockItem.StockItem_StockGroupID = StockGroup.StockGroupID Where StockGroup.StockGroupID = " & gID & " And StockTake.StockTake_WarehouseID = 2 AND StockItem.StockItem_Disabled=False AND StockItem.StockItem_Discontinued=False ORDER BY StockItem.StockItem_Name;") adoPrimaryRS = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Name, StockTake.StockTake_Quantity, StockTake.StockTake_StockItemID, StockTake.StockTake_WarehouseID, StockItem.StockItem_Quantity FROM (StockTake INNER JOIN StockItem ON StockTake.StockTake_StockItemID = StockItem.StockItemID) INNER JOIN StockGroup ON StockItem.StockItem_StockGroupID = StockGroup.StockGroupID Where StockGroup.StockGroupID = " + gID + " And StockTake.StockTake_WarehouseID = " + lMWNo + " AND StockItem.StockItem_Disabled=False AND StockItem.StockItem_Discontinued=False ORDER BY StockItem.StockItem_Name;"); //Multi Warehouse change } //Display the list of Titles in the DataCombo grdDataGrid.DataSource = adoPrimaryRS; grdDataGrid.Columns[0].HeaderText = "Stock Name"; grdDataGrid.Columns[0].DefaultCellStyle.Alignment = MSDataGridLib.AlignmentConstants.dbgLeft; grdDataGrid.Columns[0].Frozen = true; grdDataGrid.Columns[1].HeaderText = "Quantity"; grdDataGrid.Columns[1].DefaultCellStyle.Alignment = MSDataGridLib.AlignmentConstants.dbgRight; grdDataGrid.Columns[1].Width = sizeConvertors.twipsToPixels(900, true); //UPGRADE_WARNING: Couldn't resolve default property of object grdDataGrid.Columns().DataFormat.Type. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' grdDataGrid.Columns[1].DefaultCellStyle.Format = 1; //grdDataGrid.Columns(1).NumberFormat = "#,##0.0000" grdDataGrid.Columns[1].Frozen = false; grdDataGrid.Columns[2].Visible = false; grdDataGrid.Columns[3].Visible = false; grdDataGrid.Columns[4].Visible = false; if (blHandHeld == true) { grdDataGrid.Columns[5].Visible = false; grdDataGrid.Columns[1].Frozen = true; } frmStockTake_Resize(this, new System.EventArgs()); mbDataChanged = false; }
private void cmdBarcodes_Click() { int x = 0; ADODB.Recordset rs = default(ADODB.Recordset); string lCode = null; string lID = null; string lQuantity = null; bool changeCode = false; return; // If id = 0 Then // cnnDB.Execute "UPDATE Catalogue SET Catalogue.Catalogue_Barcode = ""0"" WHERE (((IsNumeric([Catalogue_Barcode]))<>0));" modRecordSet.cnnDB.Execute("UPDATE Catalogue INNER JOIN StockItem ON Catalogue.Catalogue_StockItemID = StockItem.StockItemID SET Catalogue.Catalogue_Barcode = '0' WHERE (((Left([Catalogue_Barcode],3))='888') AND ((StockItem.StockItem_BrandItemID)>0));"); for (x = 1; x <= 15; x++) { modRecordSet.cnnDB.Execute("UPDATE Catalogue SET Catalogue.Catalogue_Barcode = Mid([Catalogue_Barcode],2,999) WHERE (((Left([Catalogue_Barcode],1))=\"0\"));"); } rs = modRecordSet.getRS(ref "SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue;"); // Set rs = getRS("SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue WHERE Catalogue.Catalogue_Barcode = '0';") // Else // Set rs = getRS("SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue WHERE (((Catalogue.Catalogue_StockItemID)=" & id & "));") // End If if (rs.RecordCount) { rs.MoveFirst(); while (!(rs.EOF)) { changeCode = true; lCode = rs.Fields("Catalogue_Barcode").Value; if (doCheckSum(ref lCode)) { if (Strings.Len(lCode) > 5) { changeCode = false; } } if (changeCode) { lID = rs.Fields("Catalogue_StockItemID").Value; lQuantity = rs.Fields("Catalogue_Quantity").Value; lCode = lID + "0" + lQuantity; lCode = "888" + Strings.Right(new string("0", 9) + lCode + "0", 9); lCode = modApplication.addCheckSum(ref lCode); modRecordSet.cnnDB.Execute("UPDATE Catalogue SET Catalogue_Barcode = '" + Strings.Replace(lCode, "'", "''") + "' WHERE Catalogue_StockItemID = " + lID + " AND Catalogue_Quantity = " + lQuantity); } rs.moveNext(); } } }
private void frmVNC_Load(System.Object eventSender, System.EventArgs eventArgs) { optType.AddRange(new RadioButton[] { _optType_0, _optType_1 }); RadioButton rb = new RadioButton(); _optType_0.CheckedChanged += optType_CheckedChanged; _optType_1.CheckedChanged += optType_CheckedChanged; ADODB.Recordset rs = default(ADODB.Recordset); short x = 0; System.Windows.Forms.ListViewItem lItem = null; lvPOS.Items.Clear(); rs = modRecordSet.getRS(ref "SELECT * FROM POS ORDER BY POSID"); while (!(rs.EOF)) { //UPGRADE_WARNING: Lower bound of collection lvPOS.ListItems.ImageList has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' lItem = lvPOS.Items.Add("POS" + rs.Fields("POSID").Value, rs.Fields("POS_Name").Value + " (" + rs.Fields("POS_IPAddress").Value + ")", 1); //UPGRADE_WARNING: Lower bound of collection lItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' if (lItem.SubItems.Count > 1) { lItem.SubItems[1].Text = rs.Fields("POS_Name").Value; } else { lItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("POS_Name").Value)); } //UPGRADE_WARNING: Lower bound of collection lItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' if (lItem.SubItems.Count > 2) { lItem.SubItems[2].Text = rs.Fields("POS_IPAddress").Value; } else { lItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("POS_IPAddress").Value)); } //UPGRADE_WARNING: Lower bound of collection lItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' if (lItem.SubItems.Count > 3) { lItem.SubItems[3].Text = rs.Fields("POS_Disabled").Value; } else { lItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("POS_Disabled").Value)); } rs.moveNext(); } loadLanguage(); }
private string doString(ref string lString, ref ADODB.Recordset rs) { string functionReturnValue = null; string lString1 = null; string lString2 = null; string lText = null; if (Strings.Len(lString) > 15) { lText = Strings.Mid(lString, 16); if (Strings.InStr(lText, "NAME 1 CENTER")) { lString1 = rs.Fields("PersonName").Value; splitString(ref Strings.Len(lText), ref lString1, ref lString2); functionReturnValue = Strings.Left(lString, 15) + doCenter(ref lText, ref lString1); return(functionReturnValue); } if (Strings.InStr(lText, "DATE")) { lString1 = Strings.Format(DateAndTime.Now, "yymm"); functionReturnValue = Strings.Left(lString, 15) + Strings.Format(DateAndTime.Now, "yymm"); return(functionReturnValue); } if (Strings.InStr(lText, "BARCODE")) { if (doCheckSum(ref rs.Fields("Person_QuickAccess").Value)) { } else { functionReturnValue = Strings.Left(lString, 15) + rs.Fields("Person_QuickAccess").Value; } return(functionReturnValue); } if (Strings.InStr(lText, "600106007141")) { if (doCheckSum(ref rs.Fields("Person_QuickAccess").Value)) { functionReturnValue = Strings.Left(lString, 15) + rs.Fields("Person_QuickAccess").Value; } return(functionReturnValue); } functionReturnValue = lString; } else { functionReturnValue = lString; } return(functionReturnValue); }
private void showLabels() { rs = modRecordSet.getRS(ref "SELECT Person.PersonID, [Person_FirstName] & ' ' & [Person_LastName] AS PersonName, Person.Person_QuickAccess, Label.* From Person, Label Where Person.Person_Disabled = False And Label.Label_Type = 3 ANd PersonID <> 1 ORDER BY [Person_FirstName] & ' ' & [Person_LastName];"); this.lstPerson.Items.Clear(); string tmpString = null; while (!(rs.EOF)) { tmpString = rs.Fields("PersonName").Value + " " + rs.Fields("PersonID").Value; lstPerson.Items.Add(tmpString); tmpString = ""; rs.MoveNext(); } }
private void DataList1_DblClick(System.Object eventSender, KeyEventArgs eventArgs) { ADODB.Recordset rsRpt = default(ADODB.Recordset); ADODB.Recordset rsSP = default(ADODB.Recordset); if (cmdNew.Visible) { if (!string.IsNullOrEmpty(DataList1.BoundText)) { rsRpt = modRecordSet.getRS(ref "SELECT Company_SecurityPerm From Company"); //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' if (Information.IsDBNull(rsRpt.Fields("Company_SecurityPerm").Value)) { } else if (rsRpt.Fields("Company_SecurityPerm").Value == 0) { } else { rsSP = modRecordSet.getRS(ref "SELECT Person_SecurityBit FROM Person where PersonID = " + DataList1.BoundText); if (rsSP.BOF | rsSP.EOF) { Interaction.MsgBox("You do not have security permissions to perform this action.", MsgBoxStyle.Critical, "4POS"); return; } else { if (rsSP.Fields("Person_SecurityBit").Value > My.MyProject.Forms.frmMenu.gBit) { Interaction.MsgBox("You do not have security permissions to perform this action.", MsgBoxStyle.Critical, "4POS"); return; } } } My.MyProject.Forms.frmPerson.loadItem(ref Convert.ToInt32(DataList1.BoundText)); } doSearch(); } else { if (string.IsNullOrEmpty(DataList1.BoundText)) { gID = 0; } else { gID = Convert.ToInt32(DataList1.BoundText); } this.Close(); } }
private void loadData() { ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "SELECT StockItem.StockItemID, StockItem.StockItem_Name, PackSize.PackSize_Volume FROM StockItem INNER JOIN PackSize ON StockItem.StockItem_PackSizeID = PackSize.PackSizeID WHERE (((StockItem.StockItemID)=" + gStockItemID + "));"); if (rs.RecordCount) { lblStockItem.Text = rs.Fields("StockItem_Name").Value; txtQty.Text = Strings.FormatNumber(gQuantity, 4); txtPrice.Text = Strings.FormatNumber(gQuantity * (rs.Fields("PackSize_Volume").Value == 0 ? 1 : rs.Fields("PackSize_Volume").Value), 2); this.Height = sizeConvertors.twipsToPixels(4785, false); ShowDialog(); } }
private void cmdPrint_Click(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); string sql = null; ADODB.Recordset rsData = default(ADODB.Recordset); CrystalDecisions.CrystalReports.Engine.ReportDocument Report = default(CrystalDecisions.CrystalReports.Engine.ReportDocument); CrystalDecisions.CrystalReports.Engine.ReportDocument Report1 = default(CrystalDecisions.CrystalReports.Engine.ReportDocument); Report.Load("cryNegativeProfit.rpt"); Report1.Load("crysqZero.rpt"); string lOrder = null; string lWhere = null; if (gRS.RecordCount) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; rs = modRecordSet.getRS(ref "SELECT * FROM Company"); Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name")); rs.Close(); //Report.VerifyOnEveryPrint = True Report.Database.Tables(1).SetDataSource(gRS); //Report.Database.SetDataSource(gRS, 3) My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); } if (gRSsq.RecordCount) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; rs = modRecordSet.getRS(ref "SELECT * FROM Company"); Report1.SetParameterValue("txtCompanyName", rs.Fields("Company_Name")); rs.Close(); //Report1.VerifyOnEveryPrint = True Report1.Database.Tables(1).SetDataSource(gRSsq); //Report1.Database.SetDataSource(gRSsq, 3) My.MyProject.Forms.frmReportShow.Text = Report1.ParameterFields("txtTitle").ToString; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report1; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); } }
private void lstSupplier_SelectedIndexChanged(System.Object eventSender, System.EventArgs eventArgs) { string ltype = null; ADODB.Recordset rs = default(ADODB.Recordset); System.Windows.Forms.ListViewItem lvItem = null; if (lstSupplier.SelectedIndex == -1) { return; } rs = modRecordSet.getRS(ref "SELECT TOP 100 GRV.GRVID, Supplier.SupplierID, Supplier.Supplier_Name, GRV.GRV_GRVStatusID, GRV.GRV_InvoiceNumber, GRV.GRV_InvoiceDate, GRV.GRV_InvoiceInclusive, Supplier.Supplier_GRVtype FROM (PurchaseOrder INNER JOIN GRV ON PurchaseOrder.PurchaseOrderID = GRV.GRV_PurchaseOrderID) INNER JOIN Supplier ON PurchaseOrder.PurchaseOrder_SupplierID = Supplier.SupplierID Where (((Supplier.SupplierID) = " + Convert.ToInt64(lstSupplier.SelectedIndex) + ")) ORDER BY GRV.GRV_InvoiceDate DESC;"); this.lvItems.Items.Clear(); while (!(rs.EOF)) { if (Information.IsDBNull(rs.Fields("Supplier_GRVtype").Value)) { ltype = "normal"; } else { ltype = rs.Fields("Supplier_GRVtype").Value; if (string.IsNullOrEmpty(ltype)) { ltype = "normal"; } } lvItem = lvItems.Items.Add("K" + rs.Fields("GRVID").Value, rs.Fields("Supplier_Name").Value, ""); lvItem.Font = new Font(lvItem.Font, rs.Fields("GRV_GRVStatusID").Value != 1); if (lvItem.SubItems.Count > 0) { lvItem.SubItems[0].Text = rs.Fields("GRV_InvoiceNumber").Value; } else { lvItem.SubItems.Insert(0, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("GRV_InvoiceNumber").Value)); } if (lvItem.SubItems.Count > 0) { lvItem.SubItems[0].Text = Strings.Format(rs.Fields("GRV_InvoiceDate").Value, "dd,mmm yyyy"); } else { lvItem.SubItems.Insert(0, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.Format(rs.Fields("GRV_InvoiceDate").Value, "dd,mmm yyyy"))); } if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = Strings.FormatNumber(rs.Fields("GRV_InvoiceInclusive").Value, 1); } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("GRV_InvoiceInclusive").Value, 2))); } rs.moveNext(); } }
public void loadItem(ref int id) { short x = 0; ADODB.Recordset rs = default(ADODB.Recordset); gID = id; rs = modRecordSet.getRS(ref "SELECT Pricelist_Name FROM Pricelist WHERE PricelistID = " + gID); if (rs.BOF | rs.EOF) { } else { lblHeading.Text = rs.Fields("Pricelist_Name").Value; rs = modRecordSet.getRS(ref "SELECT TOP 100 PERCENT StockItem.StockItemID, StockItem.StockItem_Name FROM StockItem ORDER BY StockItem_Name;"); dataArray = new short[rs.RecordCount + 1, 3]; //UPGRADE_WARNING: Couldn't resolve default property of object x. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' x = -1; while (!(rs.EOF)) { x = x + 1; dataArray[x, 0] = rs.Fields("StockItemID").Value; dataArray[x, 1] = rs.Fields("StockItem_Name").Value; dataArray[x, 2] = false; rs.moveNext(); } rs = modRecordSet.getRS(ref "SELECT PricelistStockItemLnk.PricelistStockItemLnk_StockItemID From PricelistStockItemLnk WHERE (((PricelistStockItemLnk.PricelistStockItemLnk_PricelistID)=" + gID + "));"); while (!(rs.EOF)) { for (x = Information.LBound(dataArray); x <= Information.UBound(dataArray); x++) { //UPGRADE_WARNING: Couldn't resolve default property of object x. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' if (dataArray[x, 0] == rs.Fields("PricelistStockItemLnk_StockItemID").Value) { //UPGRADE_WARNING: Couldn't resolve default property of object x. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' //UPGRADE_WARNING: Couldn't resolve default property of object dataArray(x, 2). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' dataArray[x, 2] = true; } } rs.moveNext(); } doLoad(); loadLanguage(); ShowDialog(); } }
private void cmdStockItem_Click(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); int lID = 0; modReport.cnnDBreport.Execute("DELETE aftDataItem.* From aftDataItem WHERE (((aftDataItem.ftDataItem_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("DELETE aftData.* From aftData WHERE (((aftData.ftData_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("INSERT INTO aftData ( ftData_PersonID, ftData_FieldName, ftData_SQL, ftData_Heading ) SELECT LinkData.LinkData_PersonID, LinkData.LinkData_FieldName, LinkData.LinkData_SQL, LinkData.LinkData_Heading From LinkData WHERE (((LinkData.LinkData_LinkID)=1) AND ((LinkData.LinkData_SectionID)=1) AND ((LinkData.LinkData_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("INSERT INTO aftDataItem ( ftDataItem_PersonID, ftDataItem_FieldName, ftDataItem_ID ) SELECT LinkDataItem.LinkDataItem_PersonID, LinkDataItem.LinkDataItem_FieldName, LinkDataItem.LinkDataItem_ID From LinkDataItem WHERE (((LinkDataItem.LinkDataItem_LinkID)=1) AND ((LinkDataItem.LinkDataItem_SectionID)=1) AND ((LinkDataItem.LinkDataItem_PersonID)=" + modRecordSet.gPersonID + "));"); My.MyProject.Forms.frmFilter.buildCriteria(ref "StockItem"); My.MyProject.Forms.frmFilter.Close(); lID = My.MyProject.Forms.frmStockList.getItem(); if (lID) { My.MyProject.Forms.frmFilter.buildCriteria(ref "StockItem"); rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + lID); modReport.cnnDBreport.Execute("UPDATE Link SET Link.Link_Name = ' " + Strings.Replace(rs.Fields("StockItem_Name").Value, "'", "''") + "', Link.Link_SQL = 'StockItemID=" + lID + "' WHERE (((Link.LinkID)=1) AND ((Link.Link_SectionID)=1) AND ((Link.Link_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("DELETE LinkDataItem.* From LinkDataItem WHERE (((LinkDataItem.LinkDataItem_LinkID)=1) AND ((LinkDataItem.LinkDataItem_SectionID)=1) AND ((LinkDataItem.LinkDataItem_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("DELETE LinkData.LinkData_LinkID, LinkData.LinkData_SectionID, LinkData.LinkData_PersonID, LinkData.* From LinkData WHERE (((LinkData.LinkData_LinkID)=1) AND ((LinkData.LinkData_SectionID)=1) AND ((LinkData.LinkData_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("INSERT INTO LinkData ( LinkData_LinkID, LinkData_SectionID, LinkData_PersonID, LinkData_FieldName, LinkData_SQL, LinkData_Heading ) SELECT 1, 1, aftData.ftData_PersonID, aftData.ftData_FieldName, aftData.ftData_SQL, aftData.ftData_Heading From aftData WHERE (((aftData.ftData_PersonID)=" + modRecordSet.gPersonID + "));"); modReport.cnnDBreport.Execute("INSERT INTO LinkDataItem ( LinkDataItem_LinkID, LinkDataItem_SectionID, LinkDataItem_PersonID, LinkDataItem_FieldName, LinkDataItem_ID ) SELECT 1, 1, aftDataItem.ftDataItem_PersonID, aftDataItem.ftDataItem_FieldName, aftDataItem.ftDataItem_ID From aftDataItem WHERE (((aftDataItem.ftDataItem_PersonID)=" + modRecordSet.gPersonID + "));"); lblItem.Text = rs.Fields("StockItem_Name").Value; } }
private void cmdSelComp_Click(System.Object eventSender, System.EventArgs eventArgs) { //frmSelComp.show 1 ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rj = default(ADODB.Recordset); loadDBStr = My.MyProject.Forms.frmSelComp.loadDB(); if (string.IsNullOrEmpty(loadDBStr)) { } else { cn = modRecordSet.openSComp(ref loadDBStr); if (cn == null) { } else { rj = modRecordSet.getRSwaitron(ref "SELECT Company_Name FROM Company;", ref cn); lblSComp.Text = rj.Fields("Company_Name").Value; cmdAdd.Enabled = true; cmdDelete.Enabled = true; } } }
public void loadItem(ref int id) { if (id) { } else { return; } My.MyProject.Forms.frmStockTakeSnapshot.remoteSnapShot(); System.Windows.Forms.Application.DoEvents(); ADODB.Recordset rs = default(ADODB.Recordset); gID = id; lMWNo = My.MyProject.Forms.frmMWSelect.getMWNo(); //Multi Warehouse change rs = modRecordSet.getRS(ref "SELECT StockGroup.StockGroupID, StockGroup.StockGroup_Name From StockGroup WHERE (((StockGroup.StockGroupID)=" + gID + "));"); lblHeading.Text = rs.Fields("StockGroup_Name").Value; getNamespace(); mbDataChanged = false; loadLanguage(); ShowDialog(); }
private void cmdDelete_Click(System.Object eventSender, System.EventArgs eventArgs) { // ERROR: Not supported in C#: OnErrorStatement ADODB.Recordset rs = default(ADODB.Recordset); if (this.lvImport.FocusedItem == null) { } else { if (Interaction.MsgBox("Are you sure you wish to delete the selected Production Test", MsgBoxStyle.YesNo) == MsgBoxResult.Yes) { rs = modRecordSet.getRS(ref "SELECT * FROM VegTest WHERE VegTest.VegTestID =" + Strings.Mid(this.lvImport.FocusedItem.Name, 2) + ";"); if (rs.Fields("VegTest_VegTestStatusID").Value == 3) { Interaction.MsgBox("You may not delete Processed Production Test!"); } else { modRecordSet.cnnDB.Execute("DELETE * FROM VegTest WHERE VegTest.VegTestID =" + Strings.Mid(this.lvImport.FocusedItem.Name, 2)); modRecordSet.cnnDB.Execute("DELETE * FROM VegTestItem WHERE VegTestItem_VegTestID =" + Strings.Mid(this.lvImport.FocusedItem.Name, 2)); } doSearch(); } } }
public void AutomaticPOSUpdate() { setup(); loadSummary(); this.Cursor = System.Windows.Forms.Cursors.WaitCursor; ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "SELECT * FROM Scale"); if (rs.RecordCount) { if (rs.Fields("Scale_Update").Value) { cmdScale_Click(cmdScale, new System.EventArgs()); } } modRecordSet.cnnDB.Execute("INSERT INTO StockItemTalker ( StockItemID ) SELECT DISTINCT POSUpdate_PriceChangeSummary.CatalogueChannelLnk_StockItemID FROM StockItemTalker RIGHT JOIN POSUpdate_PriceChangeSummary ON StockItemTalker.StockItemID = POSUpdate_PriceChangeSummary.CatalogueChannelLnk_StockItemID WHERE (((StockItemTalker.StockItemID) Is Null) AND ((POSUpdate_PriceChangeSummary.CatalogueChannelLnk_ChannelID)=1));"); modRecordSet.cnnDB.Execute("INSERT INTO POSCatalogue ( POSCatalogue_StockItemID, POSCatalogue_Quantity, POSCatalogue_Barcode, POSCatalogue_Deposit, POSCatalogue_Content ) SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode, Catalogue.Catalogue_Deposit, Catalogue.Catalogue_Content FROM Catalogue LEFT JOIN POSCatalogue ON (Catalogue.Catalogue_StockItemID = POSCatalogue.POSCatalogue_StockItemID) AND (Catalogue.Catalogue_Quantity = POSCatalogue.POSCatalogue_Quantity) WHERE (((POSCatalogue.POSCatalogue_StockItemID) Is Null) AND ((Catalogue.Catalogue_Disabled)=0));"); modRecordSet.cnnDB.Execute("INSERT INTO POSCatalogueChannelLnk ( POSCatalogueChannelLnk_StockItemID, POSCatalogueChannelLnk_ChannelID, POSCatalogueChannelLnk_Quantity, POSCatalogueChannelLnk_Price ) SELECT CatalogueChannelLnk.CatalogueChannelLnk_StockItemID, CatalogueChannelLnk.CatalogueChannelLnk_ChannelID, CatalogueChannelLnk.CatalogueChannelLnk_Quantity, POSCatalogueChannelLnk.POSCatalogueChannelLnk_Price FROM CatalogueChannelLnk LEFT JOIN POSCatalogueChannelLnk ON (CatalogueChannelLnk.CatalogueChannelLnk_ChannelID = POSCatalogueChannelLnk.POSCatalogueChannelLnk_ChannelID) AND (CatalogueChannelLnk.CatalogueChannelLnk_Quantity = POSCatalogueChannelLnk.POSCatalogueChannelLnk_Quantity) AND (CatalogueChannelLnk.CatalogueChannelLnk_StockItemID = POSCatalogueChannelLnk.POSCatalogueChannelLnk_StockItemID) WHERE (((POSCatalogueChannelLnk.POSCatalogueChannelLnk_StockItemID) Is Null));"); modRecordSet.cnnDB.Execute("UPDATE POSCatalogueChannelLnk INNER JOIN (CatalogueChannelLnk INNER JOIN systemStockItemPricing ON CatalogueChannelLnk.CatalogueChannelLnk_StockItemID = systemStockItemPricing.systemStockItemPricing) ON (POSCatalogueChannelLnk.POSCatalogueChannelLnk_ChannelID = CatalogueChannelLnk.CatalogueChannelLnk_ChannelID) AND (CatalogueChannelLnk.CatalogueChannelLnk_Quantity = POSCatalogueChannelLnk.POSCatalogueChannelLnk_Quantity) AND (POSCatalogueChannelLnk.POSCatalogueChannelLnk_StockItemID = CatalogueChannelLnk.CatalogueChannelLnk_StockItemID) SET POSCatalogueChannelLnk.POSCatalogueChannelLnk_Price = [CatalogueChannelLnk]![CatalogueChannelLnk_Price];"); modRecordSet.cnnDB.Execute("DELETE tempStockItem.* FROM systemStockItemPricing INNER JOIN tempStockItem ON systemStockItemPricing.systemStockItemPricing = tempStockItem.tempStockItemID;"); modRecordSet.cnnDB.Execute("UPDATE Company SET Company.Company_PosUpdate = 1;"); this.Cursor = System.Windows.Forms.Cursors.Default; this.Close(); }
private void loadData() { ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rj = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Name, StockItem_Quantity FROM StockItem WHERE ((StockItem.StockItemID)=" + gStockItemID + ");"); if (rs.RecordCount) { lblStockItem.Text = rs.Fields("StockItem_Name").Value; txtPSize.Text = rs.Fields("StockItem_Quantity").Value; this.Height = sizeConvertors.twipsToPixels(2520, false); loadLanguage(); ShowDialog(); } }
public bool loadFilter(ref string filter_Renamed) { bool functionReturnValue = false; ADODB.Recordset rs = new ADODB.Recordset(); ADODB.Recordset RSitem = new ADODB.Recordset(); short lCNT = 0; rs = modRecordSet.getRS(ref "SELECT * From ftOrderSet Where (((ftSet_Group) = 'order')) ORDER BY ftSet_Order;"); if (rs.BOF | rs.EOF) { functionReturnValue = false; } else { lCNT = -1; objectArray = new object[rs.RecordCount]; while (!(rs.EOF)) { lCNT = lCNT + 1; switch (rs.Fields("ftset_type").Value) { case 2: if (lCNT) { //_frmList_0. //frmList.Load(lCNT) //cmdList.Load(lCNT) cmdList[lCNT].Parent = _frmList_0; //lblList.Load(lCNT) _lblList_0.Parent = _frmList_0; } _frmList_0.Visible = true; _cmdList_0.Visible = true; _lblList_0.Visible = true; if (lCNT) _frmList_0.Top = sizeConvertors.twipsToPixels(lCNT * sizeConvertors.pixelToTwips(_frmList_0.Height, false) + sizeConvertors.pixelToTwips(_frmList_0.Top, false), false); _frmList_0.Text = rs.Fields("ftset_DisplayName").Value; _frmList_0.Tag = rs.Fields("ftset_Name").Value; _lblList_0.Text = ""; RSitem = modRecordSet.getRS(ref "SELECT ftData_Heading From ftOrder WHERE (ftData_PersonID = " + modRecordSet.gPersonID + ") AND (ftData_FieldName = '" + Strings.Replace(_frmList_0.Tag, "'", "''") + "')"); if (RSitem.BOF | RSitem.EOF) { } else { _lblList_0.Text = RSitem.Fields("ftData_Heading").Value; } objectArray[lCNT] = _frmList_0; break; } rs.MoveNext(); } this.Height = sizeConvertors.twipsToPixels(objectArray[Information.UBound(objectArray)].Top + objectArray[Information.UBound(objectArray)].Height + 1000, false); loadLanguage(); ShowDialog(); functionReturnValue = true; } return functionReturnValue; }
public void loadItem() { ADODB.Recordset rj = default(ADODB.Recordset); System.Windows.Forms.CheckBox oCheck = null; adoPrimaryRS = modRecordSet.getRS(ref "SELECT Company_HOParamBit FROM Company"); const short gReOrderLvl = 1; const short gEmployeePer = 2; const short gWaitronCount = 4; const short gActualCost = 8; const short gPromotion = 16; const short gRecipe = 32; // ERROR: Not supported in C#: OnErrorStatement //Bind the check boxes to the data provider this._chkBit_1.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gReOrderLvl))); this._chkBit_2.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gEmployeePer))); this._chkBit_3.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gWaitronCount))); this._chkBit_4.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gActualCost))); this._chkBit_5.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gPromotion))); this._chkBit_6.CheckState = System.Math.Abs(Convert.ToInt32(Convert.ToBoolean(adoPrimaryRS.Fields("Company_HOParamBit").Value & gRecipe))); ShowDialog(); }
public customer getCustomer(ref int id) { string sql = null; ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rs = default(ADODB.Recordset); customer customer_Renamed = null; if (id) { cn = modRecordSet.openConnectionInstance(); if (cn == null) { Interaction.MsgBox("You are not connected to the 4POS BackOffice server! This task can only be performed if you are connected to the server. Please contact your System Administrator.", MsgBoxStyle.Exclamation, "BackOffice Connection Error"); } else { rs = new ADODB.Recordset(); sql = "SELECT Customer.*, [Customer_Current]+[Customer_30Days]+[Customer_60Days]+[Customer_90Days]+[Customer_120Days]+[Customer_150Days] AS balance From Customer WHERE CustomerID=" + id; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.RecordCount) { customer_Renamed = new customer(); customer_Renamed.Key = rs.Fields("CustomerID").Value; customer_Renamed.channelID = rs.Fields("Customer_ChannelID").Value; customer_Renamed.creditLimit = rs.Fields("Customer_CreditLimit").Value; customer_Renamed.department = rs.Fields("Customer_DepartmentName").Value + ""; customer_Renamed.fax = rs.Fields("Customer_Fax").Value + ""; customer_Renamed.name = rs.Fields("Customer_InvoiceName").Value + ""; customer_Renamed.outstanding = rs.Fields("balance").Value; customer_Renamed.person = rs.Fields("Customer_FirstName").Value + " " + rs.Fields("Customer_Surname").Value; customer_Renamed.physical = rs.Fields("Customer_PhysicalAddress").Value + ""; customer_Renamed.postal = rs.Fields("Customer_PostalAddress").Value + ""; customer_Renamed.signed_Renamed = customer_Renamed.person; customer_Renamed.telephone = rs.Fields("Customer_Telephone").Value + ""; customer_Renamed.terms = rs.Fields("Customer_Terms").Value; customer_Renamed.tax = rs.Fields("Customer_VATNumber").Value + ""; } } } return customer_Renamed; }
public int getMWNo() { int functionReturnValue = 0; System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; rsMWare = modRecordSet.getRS(ref "SELECT WarehouseID, Warehouse_Name From Warehouse WHERE (WarehouseID > 1) ORDER BY WarehouseID"); if (rsMWare.RecordCount == 1) { functionReturnValue = rsMWare.Fields("WarehouseID").Value; goto jumpOut; } cmbMWNo.Items.Clear(); while (!(rsMWare.EOF)) { cmbMWNo.Items.Add(new LBI(rsMWare.Fields("Warehouse_Name").Value, rsMWare.Fields("WarehouseID").Value)); rsMWare.moveNext(); } cmbMWNo.SelectedIndex = 0; txtWNO.Text = Convert.ToString(cmbMWNo.SelectedIndex); loadLanguage(); this.ShowDialog(); functionReturnValue = lMWNo; jumpOut: return functionReturnValue; }
public void loadItem(ref int id) { System.Windows.Forms.Label oLabel = null; string sql = null; ADODB.Recordset rs = default(ADODB.Recordset); int lQty = 0; rs = modRecordSet.getRS(ref "SELECT StockitemHistory.StockitemHistory_StockItemID From StockitemHistory WHERE (((StockitemHistory.StockitemHistory_StockItemID)=" + id + "));"); if (rs.RecordCount == 0) { sql = "INSERT INTO StockitemHistory (StockitemHistory_StockItemID, StockitemHistory_Value, StockitemHistory_Day1, StockitemHistory_Day2, StockitemHistory_Day3, StockitemHistory_Day4, StockitemHistory_Day5, StockitemHistory_Day6, StockitemHistory_Day7, StockitemHistory_Day8, StockitemHistory_Day9, StockitemHistory_Day10, StockitemHistory_Day11, StockitemHistory_Day12, StockitemHistory_Week1, StockitemHistory_Week2, StockitemHistory_Week3, StockitemHistory_Week4, StockitemHistory_Week5, StockitemHistory_Week6, StockitemHistory_Week7, StockitemHistory_Week8, StockitemHistory_Week9, StockitemHistory_Week10, StockitemHistory_Week11, StockitemHistory_Week12, StockitemHistory_Month1, StockitemHistory_Month2, StockitemHistory_Month3, StockitemHistory_Month4, StockitemHistory_Month5, StockitemHistory_Month6, StockitemHistory_Month7, StockitemHistory_Month8, StockitemHistory_Month9, StockitemHistory_Month10, StockitemHistory_Month11, StockitemHistory_Month12 )"; sql = sql + " SELECT " + id + ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;"; modRecordSet.cnnDB.Execute(sql); } // Set rs = getRS("SELECT SaleItem.SaleItem_StockItemID, Sum(IIf([SaleItem_Reversal],0-[SaleItem_ShrinkQuantity]*[SaleItem_Quantity],[SaleItem_ShrinkQuantity]*[SaleItem_Quantity])) AS qty FROM Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN Company ON Sale.Sale_DayEndID = Company.Company_MonthEndID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID Where (((SaleItem.SaleItem_Revoke) = 0) And ((SaleItem.SaleItem_DepositType) = 0) And ((Consignment.ConsignmentID) Is Null) And ((Consignment_1.ConsignmentID) Is Null)) GROUP BY SaleItem.SaleItem_StockItemID HAVING (((SaleItem.SaleItem_StockItemID)=" & id & "));") sql = "SELECT Sum(sales.qty) AS SumOfqty FROM (SELECT SaleItem.SaleItem_StockItemID, (IIf([SaleItem_Reversal],0-[SaleItem_ShrinkQuantity]*[SaleItem_Quantity],[SaleItem_ShrinkQuantity]*[SaleItem_Quantity])) AS qty FROM Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN Company ON Sale.Sale_DayEndID = Company.Company_DayEndID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID Where (((SaleItem.SaleItem_StockItemID) = " + id + ") And ((SaleItem.SaleItem_Revoke) = 0) And ((SaleItem.SaleItem_DepositType) = 0) And ((Consignment.ConsignmentID) Is Null) And ((Consignment_1.ConsignmentID) Is Null)) Union SELECT SaleItemReciept.SaleItemReciept_StockitemID AS SaleItem_StockItemID, IIf([SaleItem_Reversal],0-[SaleItemReciept_Quantity]*[SaleItem_Quantity],[SaleItemReciept_Quantity]*[SaleItem_Quantity]) AS qty "; sql = sql + "FROM (Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN Company ON Sale.Sale_DayEndID = Company.Company_DayEndID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID) INNER JOIN SaleItemReciept ON SaleItem.SaleItemID = SaleItemReciept.SaleItemReciept_SaleItemID WHERE (((SaleItemReciept.SaleItemReciept_StockitemID)=" + id + ") AND ((SaleItem.SaleItem_Revoke)=0) AND ((SaleItem.SaleItem_DepositType)=0) AND ((Consignment.ConsignmentID) Is Null) AND ((Consignment_1.ConsignmentID) Is Null) AND ((SaleItem.SaleItem_Recipe)<>0))) AS sales;"; //wrong calculation cuz DayEndID = MonthEndID //sql = "SELECT Sum(sales.qty) AS SumOfqty FROM (SELECT SaleItem.SaleItem_StockItemID, (IIf([SaleItem_Reversal],0-[SaleItem_ShrinkQuantity]*[SaleItem_Quantity],[SaleItem_ShrinkQuantity]*[SaleItem_Quantity])) AS qty FROM Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN Company ON Sale.Sale_DayEndID = Company.Company_MonthEndID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID Where (((SaleItem.SaleItem_StockItemID) = " & id & ") And ((SaleItem.SaleItem_Revoke) = 0) And ((SaleItem.SaleItem_DepositType) = 0) And ((Consignment.ConsignmentID) Is Null) And ((Consignment_1.ConsignmentID) Is Null)) Union SELECT SaleItemReciept.SaleItemReciept_StockitemID AS SaleItem_StockItemID, IIf([SaleItem_Reversal],0-[SaleItemReciept_Quantity]*[SaleItem_Quantity],[SaleItemReciept_Quantity]*[SaleItem_Quantity]) AS qty " //sql = sql & "FROM (Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN Company ON Sale.Sale_DayEndID = Company.Company_MonthEndID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID) INNER JOIN SaleItemReciept ON SaleItem.SaleItemID = SaleItemReciept.SaleItemReciept_SaleItemID WHERE (((SaleItemReciept.SaleItemReciept_StockitemID)=" & id & ") AND ((SaleItem.SaleItem_Revoke)=0) AND ((SaleItem.SaleItem_DepositType)=0) AND ((Consignment.ConsignmentID) Is Null) AND ((Consignment_1.ConsignmentID) Is Null) AND ((SaleItem.SaleItem_Recipe)<>0))) AS sales;" rs = modRecordSet.getRS(ref sql); if (rs.RecordCount) { lQty = Convert.ToInt32(0 + rs.Fields("SumOfqty").Value); } else { lQty = 0; } sql = "SELECT StockItem.StockItemID, StockItem.StockItem_Name, StockItem.StockItem_Quantity, WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity, CCur([WarehouseStockItemLnk_Quantity]/[StockItem_Quantity]) AS cases, StockitemHistory.*, [StockitemHistory_Week1]+" + lQty + " AS thisWeek, [StockitemHistory_Month1]+" + lQty + " AS thisMonth, " + lQty + " AS thisDay FROM (WarehouseStockItemLnk INNER JOIN StockItem ON WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockItem.StockItemID) INNER JOIN StockitemHistory ON StockItem.StockItemID = StockitemHistory.StockitemHistory_StockItemID WHERE WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID=2 AND StockItem.StockItemID=" + id + ";"; //sql = "SELECT StockItem.StockItemID, StockItem.StockItem_Name, StockItem.StockItem_Quantity, WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity, CCur([WarehouseStockItemLnk_Quantity]/[StockItem_Quantity]) AS cases, StockitemHistory.*, [StockitemHistory_Week1]+" & lQty & " AS thisWeek, [StockitemHistory_Month1]+" & lQty & " AS thisMonth, " & lQty & " AS thisDay FROM (WarehouseStockItemLnk INNER JOIN StockItem ON WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockItem.StockItemID) INNER JOIN StockitemHistory ON StockItem.StockItemID = StockitemHistory.StockitemHistory_StockItemID WHERE StockItem.StockItemID=" & id & ";" adoPrimaryRS = modRecordSet.getRS(ref sql); if (adoPrimaryRS.RecordCount == 0) { return; } foreach (Label oLabel_loopVariable in this.lblField) { oLabel = oLabel_loopVariable; oLabel.DataBindings.Add(adoPrimaryRS); } this._lblFieldCurr_0.Text = Strings.FormatNumber(adoPrimaryRS.Fields("cases").Value, 2); loadLanguage(); ShowDialog(); }
public void loadItem(ref int id) { System.Windows.Forms.TextBox oText = null; adoPrimaryRS = modRecordSet.getRS(ref "SELECT MonthEnd.MonthEndID, IIf([MonthEndID]=[Company_MonthEndID],'Current',[Company_MonthEndID]-[MonthEndID] & ' month/s ago') AS theMonth, MonthEnd.MonthEnd_Days, MonthEnd.MonthEnd_BudgetSales, MonthEnd.MonthEnd_BudgetPurchases From MonthEnd, Company Where MonthEnd.MonthEndID = " + id); setup(); this.lblMonth.Text = adoPrimaryRS.Fields("theMonth").Value; // For Each oText In Me.txtFields // Set oText.DataBindings.Add(adoPrimaryRS) // oText.MaxLength = adoPrimaryRS(oText.DataField).DefinedSize // Next foreach (TextBox oText_loopVariable in txtInteger) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.Leave += txtInteger_Leave; //txtInteger_Leave(txtInteger.Item((oText.Index)), New System.EventArgs()) } foreach (TextBox oText_loopVariable in txtFloat) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); if (string.IsNullOrEmpty(oText.Text)) oText.Text = "0"; oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100); oText.Leave += txtFloat_Leave; //txtFloat_Leave(txtFloat.Item((oText.Index)), New System.EventArgs()) } // For Each oText In Me.txtFloatNegative // Set oText.DataBindings.Add(adoPrimaryRS) // If oText.Text = "" Then oText.Text = "0" // oText.Text = oText.Text * 100 // txtFloatNegative_LostFocus oText.Index // Next //Bind the check boxes to the data provider // For Each oCheck In Me.chkFields // Set oCheck.DataBindings.Add(adoPrimaryRS) // Next buildDataControls(); mbDataChanged = false; loadLanguage(); ShowDialog(); }
public void loadItem() { ADODB.Recordset rs = default(ADODB.Recordset); System.Windows.Forms.TextBox oText = null; System.Windows.Forms.CheckBox oCheck = null; // ERROR: Not supported in C#: OnErrorStatement //Old //Set adoPrimaryRS = getRS("select CompanyID, Company_PosHeading1,Company_PosHeading2,Company_PosHeading3,Company_PosFooter,Company_TaxNumber,Company_PosPrintAccountPayments,Company_PosPrintAccountSales,Company_PosPrintAccountCOD,Company_PosPrintConsignment,Company_PosParameters,Company_POSRecieptPrint from Company") //New with text narative adoPrimaryRS = modRecordSet.getRS(ref "select CompanyID, Company_PosHeading1,Company_PosHeading2,Company_PosHeading3,Company_PosFooter,Company_TaxNumber,Company_PosPrintAccountPayments,Company_PosPrintAccountSales,Company_PosPrintAccountCOD,Company_PosPrintConsignment,Company_POSExcess,Company_PosParameters,Company_POSRecieptPrint,Company_PosPrintPayouts,Company_PosCentRound from Company"); setup(); foreach (TextBox oText_loopVariable in txtFields) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize; } foreach (TextBox oText_loopVariable in this.txtInteger) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.Leave += txtInteger_Leave; //txtInteger_Leave(txtInteger.Item((oText.Index)), New System.EventArgs()) } foreach (TextBox oText_loopVariable in this.txtPrice) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.Leave += txtPrice_Leave; //txtPrice_Leave(txtPrice.Item((oText.Index)), New System.EventArgs()) } this._txtPrice_0.Text = Strings.FormatNumber(adoPrimaryRS.Fields("Company_POSExcess").Value, 2); //_txtFields_9.MaxLength = 7 _txtFields_9.MaxLength = 8; buildDataControls(); mbDataChanged = false; //Me.optPrint(_txtFields_5).Checked = True if (_txtFields_5.Text == "0") { _optPrint_0.Checked = true; } else if (_txtFields_5.Text == "1") { _optPrint_1.Checked = true; } else { _optPrint_2.Checked = true; } loadLanguage(); ShowDialog(); }
private void cmdsearch_Click_AllocByID(ref int PId) { bool prPrevSerial_p = false; int x = 0; string sql = null; string databaseName = null; short y = 0; short lMonth = 0; ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rs = new ADODB.Recordset(); bSelectPayment = true; if (gLoading) return; gLoading = true; Cursor = System.Windows.Forms.Cursors.WaitCursor; System.Windows.Forms.Application.DoEvents(); lMonth = Convert.ToInt16(cmbMonth.SelectedIndex); if (lMonth == gMonthEnd) { databaseName = "pricing.mdb"; } else { databaseName = "Month" + lMonth + ".mdb"; } //If openConnection() Then // frmMain.lblPath.Caption = serverPath // closeConnection //End If cn = modRecordSet.openConnectionInstance(ref databaseName); if (cn == null) { return; } string lString = null; string lCustomerString = null; string lStockString = null; string lPosString = null; if (this.cmbPOS.SelectedIndex) lPosString = " AND (Sale_PosID=" + cmbPOS.SelectedIndex + ")"; lString = Strings.Trim(txtCustomer.Text); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); //If lString <> "" Then //lString = "(Customer_InvoiceName LIKE '%" & Replace(lString, " ", "%' AND Customer_InvoiceName LIKE '%") & "%')" lString = "(CustomerID = " + adoPrimaryRS.Fields("CustomerID").Value + ")"; //Else // lString = "" //End If lCustomerString = lString; if (!string.IsNullOrEmpty(lCustomerString)) lCustomerString = " AND (" + lCustomerString + ") "; //Cater for one at a time if (!string.IsNullOrEmpty(Strings.Trim(this.txtStock.Text))) { y = 1; lString = Strings.Trim(this.txtStock.Text); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); } if (!string.IsNullOrEmpty(Strings.Trim(this.txtSerial.Text))) { prPrevSerial_p = true; y = 2; lString = Strings.Trim(this.txtSerial.Text); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); } if (!string.IsNullOrEmpty(lString)) { //By StockItem........ if (y == 1) lString = "(StockItem_Name LIKE '%" + Strings.Replace(lString, " ", "%' AND StockItem_Name LIKE '%") + "%')"; //By Serial Number...... if (y == 2) lString = "(Sale.Sale_Serialref LIKE '" + Strings.Replace(lString, " ", "%' AND Sale.Sale_Serialref LIKE '%") + "%')"; } else { lString = ""; } lStockString = lString; if (!string.IsNullOrEmpty(lStockString)) lStockString = " AND (" + lStockString + ") AND (SaleItem.SaleItem_DepositType=0)"; if (string.IsNullOrEmpty(lCustomerString)) { if (string.IsNullOrEmpty(lStockString)) { sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType From Sale Where ((Sale.Sale_PaymentType > 0) " + lPosString + " )ORDER BY Sale.SaleID DESC;"; } else { //By StockItem........ if (y == 1) sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM (SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN StockItem ON SaleItem.SaleItem_StockItemID = StockItem.StockItemID WHERE (((Sale.Sale_PaymentType) > 0) " + lStockString + lPosString + " ) ORDER BY Sale.SaleID DESC;"; //By Serial Number...... if (y == 2) sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM (SaleItem INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID) WHERE (((Sale.Sale_PaymentType) > 0) " + lStockString + lPosString + " ) ORDER BY Sale.SaleID DESC;"; } } else { if (string.IsNullOrEmpty(lStockString)) { sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM Customer INNER JOIN (CustomerTransaction INNER JOIN Sale ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON Customer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID Where (((Sale.Sale_PaymentType) > 0) " + lCustomerString + lPosString + " ) ORDER BY Sale.SaleID DESC;"; } else { sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM (SaleItem INNER JOIN (Customer INNER JOIN (CustomerTransaction INNER JOIN Sale ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON Customer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID) ON SaleItem.SaleItem_SaleID = Sale.SaleID) INNER JOIN StockItem ON SaleItem.SaleItem_StockItemID = StockItem.StockItemID Where (((Sale.Sale_PaymentType) > 0) " + lCustomerString + lStockString + lPosString + " ) ORDER BY Sale.SaleID DESC;"; sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM StockItem, Customer INNER JOIN (CustomerTransaction INNER JOIN Sale ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON Customer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID Where (((Sale.Sale_PaymentType) > 0) And ((Customer.CustomerID) = " + adoPrimaryRS.Fields("CustomerID").Value + ")) ORDER BY Sale.SaleID DESC;"; } } sql = "SELECT DISTINCT Sale.Sale_Reference, Sale.SaleID, Sale.Sale_PosID, Sale.Sale_DatePOS, Sale.Sale_Total, Sale.Sale_Tender, Sale.Sale_PaymentType FROM StockItem, Customer INNER JOIN (CustomerTransaction INNER JOIN Sale ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) ON Customer.CustomerID = CustomerTransaction.CustomerTransaction_CustomerID Where (((Sale.Sale_PaymentType) > 0) And ((Customer.CustomerID) = " + adoPrimaryRS.Fields("CustomerID").Value + ")) ORDER BY Sale.SaleID DESC;"; sql = "SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName, CustomerTransaction.CustomerTransaction_Main, CustomerTransaction.CustomerTransaction_Child, CustomerTransaction.CustomerTransaction_Allocated," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + adoPrimaryRS.Fields("CustomerID").Value + ")) ORDER BY CustomerTransaction.CustomerTransactionID DESC;"; sql = "SELECT CustomerTransactionAlloc.CustomerTransactionAllocID, CustomerTransactionAlloc.CustomerTransactionAlloc_MainID, CustomerTransactionAlloc.CustomerTransactionAlloc_Amount, CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, " + "CustomerTransaction.CustomerTransaction_PersonName, CustomerTransaction.CustomerTransaction_Main, CustomerTransaction.CustomerTransaction_Child, CustomerTransaction.CustomerTransaction_Allocated, TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransactionAlloc INNER JOIN (CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID) ON CustomerTransactionAlloc.CustomerTransactionAlloc_ChildID = CustomerTransaction.CustomerTransactionID WHERE (((CustomerTransactionAlloc.CustomerTransactionAlloc_MainID)=" + PId + "));"; Debug.Print(sql); rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); lvTransAlloc.Items.Clear(); lblcount.Text = "0 of 0"; System.Windows.Forms.ListViewItem lvItem = null; x = 0; lvTransAlloc.Visible = false; while (!(rs.EOF)) { x = x + 1; if (gLoading) { } else { break; // TODO: might not be correct. Was : Exit Do } lblcount.Text = x + " of " + rs.RecordCount; System.Windows.Forms.Application.DoEvents(); //If rs("CustomerTransaction_Reference") = "Month End" Then if (rs.Fields("TransactionType_Name").Value == "B/Forward") { if ((Information.IsDBNull(rs.Fields("debit").Value) ? 0 : rs.Fields("debit").Value) == rs.Fields("CustomerTransaction_Allocated").Value & (Information.IsDBNull(rs.Fields("credit").Value) ? 0 : rs.Fields("credit").Value) == 0) { //Else lvItem = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionAllocID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } //Select Case rs("Sale_PaymentType") // Case 1 // lvItem.SubItems(2) = "Cash" // Case 2 // lvItem.SubItems(2) = "CR Card" // Case 3 // lvItem.SubItems(2) = "DR Card" // Case 4 // lvItem.SubItems(2) = "Cheque" // Case 5 // lvItem.SubItems(2) = "Account" // Case 7 // lvItem.SubItems(2) = "Split Tender" // Case Else // lvItem.SubItems(2) = "Cash" //End Select if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItem.SubItems.Count > 5) { lvItem.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4); } else { lvItem.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4))); } } } else if (rs.Fields("TransactionType_Name").Value == "Invoice") { //If IIf(IsNull(rs("debit")), 0, rs("debit")) = rs("CustomerTransaction_Allocated") Then //Else lvItem = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionAllocID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItem.SubItems.Count > 5) { lvItem.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4); } else { lvItem.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4))); } //End If } else if (rs.Fields("TransactionType_Name").Value == "Interest") { //If IIf(IsNull(rs("debit")), 0, rs("debit")) = rs("CustomerTransaction_Allocated") Then //Else lvItem = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionAllocID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItem.SubItems.Count > 5) { lvItem.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4); } else { lvItem.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4))); } //End If } else if (rs.Fields("TransactionType_Name").Value == "Debit Journal") { //If IIf(IsNull(rs("debit")), 0, rs("debit")) = rs("CustomerTransaction_Allocated") Then //Else lvItem = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionAllocID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItem.SubItems.Count > 5) { lvItem.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4); } else { lvItem.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransactionAlloc_Amount").Value, 4))); } //End If } rs.moveNext(); } lvTransAlloc.Visible = true; lvTransAlloc.Refresh(); Cursor = System.Windows.Forms.Cursors.Default; gLoading = false; }
private void cmdsearch_Click(System.Object eventSender, System.EventArgs eventArgs) { string eroor = null; // ERROR: Not supported in C#: OnErrorStatement //openConnection ADODB.Recordset rsP = default(ADODB.Recordset); ADODB.Recordset rsk = default(ADODB.Recordset); ADODB.Recordset rsTest = default(ADODB.Recordset); ADODB.Recordset rsNew = default(ADODB.Recordset); rs = new ADODB.Recordset(); rsP = new ADODB.Recordset(); rsk = new ADODB.Recordset(); rsk = new ADODB.Recordset(); rsTest = new ADODB.Recordset(); rsNew = new ADODB.Recordset(); if (string.IsNullOrEmpty(this.txtcode.Text)) return; //If Me.txtCode.Text <> "" Then //creating table name //Te_Name = "HandHeld" & Trim(Year(Date)) & Trim(Month(Date)) & Trim(Day(Date)) & Trim(Hour(Now)) & Trim(Minute(Now)) & Trim(Second(Now)) & "_" & frmMenu.lblUser.Tag rsTest = modRecordSet.getRS(ref "SELECT Barcodes,Description,Quantity FROM " + Te_Name + ""); //If rsTest.RecordCount And MStockNew = 0 Then rs = modRecordSet.getRS(ref "SELECT * FROM Catalogue WHERE Catalogue_Barcode='" + this.txtcode.Text + "'"); //check if the barcode exists if (rs.RecordCount > 0) { rsP = modRecordSet.getRS(ref "SELECT StockItem_Name FROM StockItem WHERE StockItemID=" + rs.Fields("Catalogue_StockItemID").Value + ""); this.txtdesc.Text = rsP.Fields("StockItem_Name").Value; this.txtqty.Focus(); //show pic if (this.cmdsearch.Text != "&Add") { if (chkPic.CheckState & picBC.Visible == true) { if (fso.FileExists(modRecordSet.serverPath + "\\images\\" + this.txtcode.Text + ".jpg")) { picBC.Image = System.Drawing.Image.FromFile(modRecordSet.serverPath + "\\images\\" + this.txtcode.Text + ".jpg"); imgBC.Image = picBC.Image; } else { Interaction.MsgBox("No picture found for " + this.txtcode.Text); } } } //show pic this.cmdsearch.Text = "&Add"; //if the barcode does not exist display a message } else if (rs.RecordCount < 1) { Interaction.MsgBox("The Item does not exist,Please add it in Stock Create/Edit, New Stock Item", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkOnly, "4POS"); this.txtcode.Text = ""; this.txtcode.Focus(); return; } //Checking if the barcode was found and if the quantity textbox has a value double NewQty = 0; if (this.cmdsearch.Text == "&Add" & !string.IsNullOrEmpty(this.txtqty.Text)) { //creating fields with their data types MyFTypes = "HandHeldID Number,Barcodes Text(50),Description Text(50),Quantity Currency"; rsk = modRecordSet.getRS(ref "SELECT * FROM " + Te_Name + ""); //if the table has not been created yet create it switch (eroor) { case // ERROR: Case labels with binary operators are unsupported : LessThan 0: // ERROR: Not supported in C#: ErrorStatement break; case 1: goto erh; break; } erh: modRecordSet.cnnDB.Execute("CREATE TABLE " + Te_Name + " (" + MyFTypes + ")"); //selecting from the new table created rsNew = modRecordSet.getRS(ref "SELECT * FROM " + Te_Name + " WHERE Barcodes='" + this.txtcode.Text + "'"); //if the item is already in the newly created table then add the previous quantity to the new one then update it if (rsNew.RecordCount > 0) { NewQty = Convert.ToDouble(this.txtqty.Text); NewQty = NewQty + rsNew.Fields("Quantity").Value; //update the quantity rsk = modRecordSet.getRS(ref "UPDATE " + Te_Name + " SET Quantity=" + NewQty + " WHERE Barcodes='" + this.txtcode.Text + "'"); } else if (rsNew.RecordCount < 1) { //inserting into the newly created table rsk = modRecordSet.getRS(ref "INSERT INTO " + Te_Name + "(HandHeldID,Barcodes,Description,Quantity)VALUES(" + rs.Fields("Catalogue_StockItemID").Value + ",'" + this.txtcode.Text + "','" + this.txtdesc.Text + "'," + this.txtqty.Text + " )"); } //selecting from the newly created table rsk = modRecordSet.getRS(ref "SELECT Barcodes,Description,Quantity FROM " + Te_Name + ""); //filling the datagrid with the record consisting of barcode,description,quantity if the barcode exist this.DataGrid1.DataSource = rsk; this.txtcode.Text = ""; this.txtdesc.Text = ""; this.txtqty.Text = ""; this.cmdsearch.Text = "&Search"; this.txtcode.Focus(); } //ElseIf rsTest.RecordCount > 0 And MStockNew = 2 Then //MsgBox "A Table with the Same Name Already Exist", vbApplicationModal + vbOKOnly, "4POS" //Me.txtCode.Text = "" //Me.cmdClose.SetFocus //End If }
private void cmdShowHistory_Click(System.Object eventSender, System.EventArgs eventArgs) { int i = 0; int x = 0; string sql = null; string databaseName = null; short y = 0; short lMonth = 0; ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rs = new ADODB.Recordset(); // ERROR: Not supported in C#: OnErrorStatement if (cmdShowHistory.Text == "&Show Full History") { cmdShowHistory.Text = "&Show Current Month"; } else { cmdShowHistory.Text = "&Show Full History"; cmdsearch_Click(cmdSearch, new System.EventArgs()); return; } if (gLoading) return; gLoading = true; Cursor = System.Windows.Forms.Cursors.WaitCursor; System.Windows.Forms.Application.DoEvents(); y = cmbMonth.Items.Count - 1; lvTransaction.Items.Clear(); lblcount.Text = "0 of 0"; lvTransaction.Visible = false; string lPosString = null; System.Windows.Forms.ListViewItem lvItem = null; //(cmbMonth.ListCount - 1) for (i = 0; i <= y; i++) { lMonth = Convert.ToInt32(cmbMonth.Items[i]); if (lMonth == gMonthEnd) { databaseName = "pricing.mdb"; } else { databaseName = "Month" + lMonth + ".mdb"; } cn = modRecordSet.openConnectionInstance(ref databaseName); if (cn == null) { goto nextMonth; //Exit Sub } //Dim lString As String //Dim lCustomerString As String //Dim lStockString As String if (this.cmbPOS.SelectedIndex) lPosString = " AND (Sale_PosID=" + cmbPOS.SelectedIndex + ")"; sql = "SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + adoPrimaryRS.Fields("CustomerID").Value + ")) ORDER BY CustomerTransaction.CustomerTransactionID DESC;"; Debug.Print(sql); rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); x = 0; //lvTransaction.Visible = False while (!(rs.EOF)) { x = x + 1; if (gLoading) { } else { break; // TODO: might not be correct. Was : Exit Do } lblcount.Text = x + " of " + rs.RecordCount; System.Windows.Forms.Application.DoEvents(); if (rs.Fields("CustomerTransaction_Reference").Value != "Month End") { lvItem = lvTransaction.Items.Add("K" + rs.Fields("CustomerTransactionID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItem.SubItems.Count > 1) { lvItem.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItem.SubItems.Count > 2) { lvItem.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItem.SubItems.Count > 3) { lvItem.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItem.SubItems.Count > 4) { lvItem.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItem.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } } rs.moveNext(); } //lvTransaction.Visible = True rs.Close(); nextMonth: } lvTransaction.Visible = true; Cursor = System.Windows.Forms.Cursors.Default; gLoading = false; return; ErrShowHistory: if (Strings.InStr(Strings.LCase(Err().Description), "not a valid path")) { Interaction.MsgBox(Err().Number + " - " + Err().Description); return; } else { Interaction.MsgBox(Err().Number + " - " + Err().Description); return; } }
private void frmIncomeExpense_Load(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = new ADODB.Recordset(); cmbMonthEnd.Items.Clear(); rs = modRecordSet.getRS(ref "SELECT Min(DayEnd.DayEnd_Date) AS MinOfDayEnd_Date, Max(DayEnd_1.DayEnd_Date) AS MaxOfDayEnd_Date, Company.Company_MonthEndID, MonthEnd.MonthEndID FROM Company, (DayEnd AS DayEnd_1 INNER JOIN MonthEnd ON DayEnd_1.DayEnd_MonthEndID = MonthEnd.MonthEndID) INNER JOIN DayEnd ON MonthEnd.MonthEndID = DayEnd.DayEnd_MonthEndID GROUP BY Company.Company_MonthEndID, MonthEnd.MonthEndID ORDER BY MonthEnd.MonthEndID DESC"); gMonth = rs.Fields("Company_MonthEndID").Value; while (!(rs.EOF)) { if (rs.Fields("Company_MonthEndID").Value == rs.Fields("MonthEndID").Value) { cmbMonthEnd.Items.Add("Current Month"); } else { cmbMonthEnd.Items.Add((rs.Fields("Company_MonthEndID").Value - rs.Fields("MonthEndID").Value) + " Month/s ago starting on the " + Strings.Format(rs.Fields("MinOfDayEnd_Date").Value, "dd MM yyyy") + " and ending on the " + Strings.Format(rs.Fields("MaxOfDayEnd_Date").Value, "dd MM yyyy") + "."); } rs.moveNext(); } cmbMonthEnd.SelectedIndex = 0; loadLanguage(); }
public void loadItem(ref int id) { System.Windows.Forms.TextBox oText = null; System.Windows.Forms.CheckBox oCheck = null; // ERROR: Not supported in C#: OnErrorStatement if (id) { adoPrimaryRS = modRecordSet.getRS(ref "select * from Channel WHERE ChannelID = " + id); // If IsNull(adoPrimaryRS("Channel_PriceToChannel1")) Then // cmbChannelPrice.ListIndex = 0 // Else switch (adoPrimaryRS.Fields("Channel_PriceToChannel1").Value) { case -1: cmbChannelPrice.SelectedIndex = 1; break; case 1: cmbChannelPrice.SelectedIndex = 2; break; default: cmbChannelPrice.SelectedIndex = 0; break; } // End If } else { adoPrimaryRS = modRecordSet.getRS(ref "select * from POS"); adoPrimaryRS.AddNew(); this.Text = this.Text + " [New record]"; mbAddNewFlag = true; } setup(); foreach (TextBox oText_loopVariable in txtFields) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize; } this.optType[Convert.ToInt16(_txtFields_0.Text)].Checked = true; if (id == 1) { _optType_0.Enabled = false; _optType_1.Enabled = false; } // For Each oText In Me.txtInteger // Set oText.DataBindings.Add(adoPrimaryRS) // txtInteger_LostFocus oText.Index // Next // For Each oText In Me.txtFloat // Set oText.DataBindings.Add(adoPrimaryRS) // If oText.Text = "" Then oText.Text = "0" // oText.Text = oText.Text * 100 // txtFloat_LostFocus oText.Index // Next // For Each oText In Me.txtFloatNegative // Set oText.DataBindings.Add(adoPrimaryRS) // If oText.Text = "" Then oText.Text = "0" // oText.Text = oText.Text * 100 // txtFloatNegative_LostFocus oText.Index // Next //Bind the check boxes to the data provider foreach (CheckBox oCheck_loopVariable in chkFields) { oCheck = oCheck_loopVariable; oCheck.DataBindings.Add(adoPrimaryRS); } buildDataControls(); mbDataChanged = false; loadLanguage(); ShowDialog(); }
private void DataList1_DblClick(System.Object eventSender, KeyPressEventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rst = default(ADODB.Recordset); ADODB.Recordset rsInner = default(ADODB.Recordset); ADODB.Recordset rsShelf = default(ADODB.Recordset); ADODB.Recordset rsBClabel = default(ADODB.Recordset); short HoldBClabelItem_BCLabelID = 0; string TheSample = null; short IntLabelID = 0; short IncrBClabelID = 0; rs = new ADODB.Recordset(); rst = new ADODB.Recordset(); rsInner = new ADODB.Recordset(); rsShelf = new ADODB.Recordset(); rsBClabel = new ADODB.Recordset(); short TheeMaxID = 0; modRecordSet.cnnDB.Execute("DELETE * FROM BClabel;"); modRecordSet.cnnDB.Execute("DELETE * FROM BClabelItem;"); modApplication.IntDesign = 1; //New code HoldBClabelItem_BCLabelID = 1; rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabelID = BClabelItem.BClabelItem_BCLabelID"); if (rs.RecordCount > 0) { if (string.IsNullOrEmpty(Strings.Trim(DataList1.CurrentCell.Value.ToString()))) { if (modApplication.TheType == 2) { Interaction.MsgBox("Please select Stock Barcode Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } else { Interaction.MsgBox("Please select Shelf Talker Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } } else { } modApplication.MyLIDWHole = Convert.ToInt16(DataList1.CurrentCell.Value); rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabel_LabelID = BClabelItem.BClabelItem_LabelID WHERE BClabelItem.BClabelItem_LabelID=" + modApplication.MyLIDWHole + ""); if (rs.RecordCount == 0) { IncrBClabelID = 1; rsInner = modRecordSet.getRS(ref "SELECT Label.*, LabelItem.* FROM Label INNER JOIN LabelItem ON Label.LabelID = LabelItem.labelItem_LabelID WHERE Label.Label_Type=2;"); rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES('Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); //Set rsBClabel = getRS("INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(1,'Stock','Stock','" & 0 & "',15," & rsInner("LabelID") & ")") while (!(rsInner.EOF)) { //**** //Inserting information into BCLabel //*** if (string.IsNullOrEmpty(Strings.Trim(rsInner.Fields("labelItem_Sample").Value))) { TheSample = " "; //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' } else if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) { TheSample = " "; } else { TheSample = rsInner.Fields("labelItem_Sample").Value; } rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + HoldBClabelItem_BCLabelID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")"); IntLabelID = rsInner.Fields("labelItem_LabelID").Value; rsInner.MoveNext(); //**** //If the ID is still for the same design then dont increment HoldBClabelItem_BCLabelID //**** // ERROR: Not supported in C#: OnErrorStatement if (IntLabelID != rsInner.Fields("labelItem_LabelID").Value) { HoldBClabelItem_BCLabelID = HoldBClabelItem_BCLabelID + 1; IncrBClabelID = IncrBClabelID + 1; if (rsInner.Fields("Label_Top").Value == 3) { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); } else { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',30," + rsInner.Fields("LabelID").Value + ")"); } } else { } } rst = modRecordSet.getRS(ref "SELECT Max(BClabelID) As MaxLaID FROM BClabel"); //Dim TheeMaxID As Integer TheeMaxID = rst.Fields("MaxLaID").Value; rsInner = modRecordSet.getRS(ref "SELECT Label.*, LabelItem.* FROM Label INNER JOIN LabelItem ON Label.LabelID = LabelItem.labelItem_LabelID WHERE Label.Label_Type=1;"); //**** //Inserting For shelf talker //**** TheeMaxID = TheeMaxID + 1; rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); while (!(rsInner.EOF)) { //**** //Inserting information into BCLabel //*** if (string.IsNullOrEmpty(Strings.Trim(rsInner.Fields("labelItem_Sample").Value))) { TheSample = " "; //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' } else if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) { TheSample = " "; } else { TheSample = rsInner.Fields("labelItem_Sample").Value; } rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + TheeMaxID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")"); IntLabelID = rsInner.Fields("labelItem_LabelID").Value; rsInner.MoveNext(); //**** //If the ID is still for the same design then dont increment HoldBClabelItem_BCLabelID //**** if (IntLabelID != rsInner.Fields("labelItem_LabelID").Value) { TheeMaxID = TheeMaxID + 1; //IncrBClabelID = IncrBClabelID + 1 if (rsInner.Fields("Label_Top").Value == 3) { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + TheeMaxID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); } else { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + TheeMaxID + ",'Stock','Stock','" + 0 + "',30," + rsInner.Fields("LabelID").Value + ")"); } } else { } } //*** //For new database //*** if (modApplication.IntDesign1 != 2) { if (string.IsNullOrEmpty(Strings.Trim(DataList1.CurrentCell.Value.ToString()))) { if (modApplication.TheType == 2) { Interaction.MsgBox("Please select Stock Barcode Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } else { Interaction.MsgBox("Please select Shelf Talker Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } } else { } } else { modApplication.IntDesign = 0; } if (modApplication.IntDesign1 == 2) { modApplication.IntDesign1 = 0; cmdNew_Click(cmdnew, new System.EventArgs()); return; } modApplication.MyLIDWHole = Convert.ToInt16(DataList1.CurrentCell.Value); rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabel_LabelID = BClabelItem.BClabelItem_LabelID WHERE BClabelItem.BClabelItem_LabelID=" + modApplication.MyLIDWHole + ""); modApplication.RecSel = rs.Fields("BClabelID").Value; //UPGRADE_NOTE: Text was upgraded to CtlText. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' modApplication.SelectLabelName = DataList1.CurrentCell.Value.ToString(); My.MyProject.Forms.frmBarcodeLoad.ShowDialog(); } else { modApplication.RecSel = rs.Fields("BClabelID").Value; //UPGRADE_NOTE: Text was upgraded to CtlText. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' modApplication.SelectLabelName = DataList1.CurrentCell.Value.ToString(); My.MyProject.Forms.frmBarcodeLoad.ShowDialog(); } } else if (rs.RecordCount < 1) { //Set rsInner = getRS("SELECT Label.*, LabelItem.* FROM Label INNER JOIN LabelItem ON Label.LabelID = LabelItem.labelItem_LabelID WHERE Label.Label_Type=2;") IncrBClabelID = 1; rsInner = modRecordSet.getRS(ref "SELECT Label.*, LabelItem.* FROM Label INNER JOIN LabelItem ON Label.LabelID = LabelItem.labelItem_LabelID WHERE Label.Label_Type=2;"); rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(1,'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); while (!(rsInner.EOF)) { //**** //Inserting information into BCLabel //*** if (string.IsNullOrEmpty(Strings.Trim(rsInner.Fields("labelItem_Sample").Value))) { TheSample = " "; //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' } else if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) { TheSample = " "; } else { TheSample = rsInner.Fields("labelItem_Sample").Value; } rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + HoldBClabelItem_BCLabelID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")"); IntLabelID = rsInner.Fields("labelItem_LabelID").Value; rsInner.MoveNext(); //**** //If the ID is still for the same design then dont increment HoldBClabelItem_BCLabelID //**** // ERROR: Not supported in C#: OnErrorStatement if (IntLabelID != rsInner.Fields("labelItem_LabelID").Value) { HoldBClabelItem_BCLabelID = HoldBClabelItem_BCLabelID + 1; IncrBClabelID = IncrBClabelID + 1; if (rsInner.Fields("Label_Top").Value == 3) { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); } else { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',30," + rsInner.Fields("LabelID").Value + ")"); } } else { } } rst = modRecordSet.getRS(ref "SELECT Max(BClabelID) As MaxLaID FROM BClabel"); //Dim TheeMaxID As Integer TheeMaxID = rst.Fields("MaxLaID").Value; rsInner = modRecordSet.getRS(ref "SELECT Label.*, LabelItem.* FROM Label INNER JOIN LabelItem ON Label.LabelID = LabelItem.labelItem_LabelID WHERE Label.Label_Type=1;"); //**** //Inserting For shelf talker //**** TheeMaxID = TheeMaxID + 1; rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + IncrBClabelID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); while (!(rsInner.EOF)) { //**** //Inserting information into BCLabel //*** if (string.IsNullOrEmpty(Strings.Trim(rsInner.Fields("labelItem_Sample").Value))) { TheSample = " "; //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' } else if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) { TheSample = " "; } else { TheSample = rsInner.Fields("labelItem_Sample").Value; } rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + TheeMaxID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")"); IntLabelID = rsInner.Fields("labelItem_LabelID").Value; rsInner.MoveNext(); //**** //If the ID is still for the same design then dont increment HoldBClabelItem_BCLabelID //**** if (IntLabelID != rsInner.Fields("labelItem_LabelID").Value) { TheeMaxID = TheeMaxID + 1; //IncrBClabelID = IncrBClabelID + 1 if (rsInner.Fields("Label_Top").Value == 3) { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + TheeMaxID + ",'Stock','Stock','" + 0 + "',15," + rsInner.Fields("LabelID").Value + ")"); } else { rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + TheeMaxID + ",'Stock','Stock','" + 0 + "',30," + rsInner.Fields("LabelID").Value + ")"); } } else { } } //*** //For new database //*** if (modApplication.IntDesign1 != 2) { if (string.IsNullOrEmpty(Strings.Trim(DataList1.CurrentCell.Value.ToString()))) { if (modApplication.TheType == 2) { Interaction.MsgBox("Please select Stock Barcode Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } else { Interaction.MsgBox("Please select Shelf Talker Design and click Next", MsgBoxStyle.Information, "4Pos Back Office"); return; } } else { } } else { modApplication.IntDesign = 0; } if (modApplication.IntDesign1 == 2) { modApplication.IntDesign1 = 0; cmdNew_Click(cmdnew, new System.EventArgs()); return; } modApplication.MyLIDWHole = Convert.ToInt16(DataList1.CurrentCell.Value); rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabel_LabelID = BClabelItem.BClabelItem_LabelID WHERE BClabelItem.BClabelItem_LabelID=" + modApplication.MyLIDWHole + ""); modApplication.RecSel = rs.Fields("BClabelID").Value; //UPGRADE_NOTE: Text was upgraded to CtlText. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' modApplication.SelectLabelName = DataList1.CurrentCell.Value.ToString(); My.MyProject.Forms.frmBarcodeLoad.ShowDialog(); } //*** if statement for checking BClabel and BClabelItem =0 end here }
private void loadCompanies() { ADODB.Recordset rs = new ADODB.Recordset(); System.Windows.Forms.ListViewItem lListitem = null; rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient; //If openConnection Then //End If rs.Open("SELECT locationCompany.locationCompanyID, location.location_Name, locationCompany.locationCompany_Name, locationCompany.locationCompany_Path FROM location INNER JOIN locationCompany ON location.locationID = locationCompany.locationCompany_LocationID ORDER BY location.location_Name, locationCompany.locationCompany_Name;", cnnDBmaster, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic); //If lvLocation.Items.Count <> 0 Then //Me.lvLocation.Items.Clear() //End If if (rs.RecordCount) { while (!(rs.EOF)) { lListitem = lvLocation.Items.Add("k" + rs.Fields("locationCompanyID").Value, rs.Fields("locationCompany_Name").Value, 2); if (lListitem.SubItems.Count > 0) { lListitem.SubItems[0].Text = rs.Fields("location_Name").Value + ""; } else { lListitem.SubItems.Insert(0, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("location_Name").Value + "")); } if (lListitem.SubItems.Count > 1) { lListitem.SubItems[1].Text = rs.Fields("locationCompany_Path").Value + ""; } else { lListitem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("locationCompany_Path").Value + "")); } if (Strings.LCase(rs.Fields("locationCompany_Path").Value + "") == Strings.LCase(modRecordSet.serverPath + "pricing.mdb")) { lListitem.Selected = true; lvLocation_DoubleClick(lvLocation, new System.EventArgs()); } rs.MoveNext(); } } }
private void cmdInv_Click(System.Object eventSender, System.EventArgs eventArgs) { CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); int personID = 0; int posID = 0; string[] lArray = null; string lAddress = null; //On Error Resume Next ADODB.Connection cn = default(ADODB.Connection); short x = 0; string databaseName = null; int lID = 0; CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rsItems = default(ADODB.Recordset); string sql = null; //UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"' System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; if (lvTransaction.FocusedItem == null) return; //lID = Mid(Split(Me.lvTransaction.SelectedItem.Key, "_")(0), 2) if (Convert.ToDouble(Strings.Split(this.lvTransaction.FocusedItem.Name, "_")[2]) == 0) { Interaction.MsgBox("There is no Sale document attached!", MsgBoxStyle.Information); System.Windows.Forms.Cursor.Current = Cursors.Default; return; } lID = Convert.ToInt32(Strings.Split(this.lvTransaction.FocusedItem.Name, "_")[2]); //If openConnection() Then // frmMain.lblPath.Caption = serverPath // closeConnection //End If //Set cn = openConnectionInstance() //lMonth = cmbMonth.ItemData(cmbMonth.ListIndex) //Dim lLineitem As lineitem //If lMonth = gMonthEnd Then // databaseName = "" //Else // databaseName = "Month" & lMonth & ".mdb" //End If databaseName = Strings.Split(this.lvTransaction.FocusedItem.Name, "_")[1]; cn = modRecordSet.openConnectionInstance(ref databaseName); if (cn == null) { return; } transaction lTransaction = new transaction(); lineItem lLineitem = null; customer lCustomer = new customer(); transactionSpecial lSpecial = new transactionSpecial(); if (Convert.ToDouble(Strings.Split(this.lvTransaction.FocusedItem.Name, "_")[3]) == 2) { //sale //Dim Report As New cryReceipt //Set Report = New cryReceipt rs = new ADODB.Recordset(); sql = "SELECT Sale.* From Sale WHERE (((SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.RecordCount) { lTransaction.cashierID = rs.Fields("Sale_PersonID").Value; lTransaction.channelID = rs.Fields("Sale_ChannelID").Value; lTransaction.managerID = rs.Fields("Sale_ManagerID").Value; lTransaction.paymentDiscount = rs.Fields("Sale_Discount").Value; lTransaction.paymentSlip = rs.Fields("Sale_Slip").Value; lTransaction.paymentSubTotal = rs.Fields("Sale_SubTotal").Value; lTransaction.paymentTender = rs.Fields("Sale_Tender").Value; lTransaction.paymentTotal = rs.Fields("Sale_Total").Value; lTransaction.paymentType = rs.Fields("Sale_PaymentType").Value; lTransaction.posID = rs.Fields("Sale_POSID").Value; lTransaction.transactionDate = rs.Fields("Sale_DatePOS").Value; lTransaction.transactionID = rs.Fields("Sale_Reference").Value + ""; lTransaction.transactionType = "Sale"; //If prPrevSerial_p = True Then strSerial = rs("Sale_Serialref") rs.Close(); rs = modRecordSet.getRS(ref "SELECT * FROM Company"); lTransaction.companyName = rs.Fields("Company_Name").Value; //gParameters.companyName lTransaction.footer = " "; //gParameters.footer & "" lTransaction.heading1 = rs.Fields("Company_PhysicalAddress").Value; //gParameters.heading1 & "" lTransaction.heading2 = " "; //gParameters.heading2 & "" lTransaction.heading3 = " "; //gParameters.heading3 & "" lTransaction.taxNumber = rs.Fields("Company_TaxNumber").Value; //gParameters.taxNumber & "" rs.Close(); sql = "SELECT [Person_FirstName] & ' ' & [Person_LastName] AS personName From Person WHERE (((PersonID)=" + lTransaction.cashierID + "));"; rs = modRecordSet.getRS(ref sql); //rs.Open sql, cn, adOpenStatic, adLockReadOnly, adCmdText if (rs.RecordCount) { lTransaction.cashierName = rs.Fields("personName").Value + ""; } rs.Close(); sql = "SELECT [Person_FirstName] & ' ' & [Person_LastName] AS personName From Person WHERE (((PersonID)=" + lTransaction.managerID + "));"; rs = modRecordSet.getRS(ref sql); //rs.Open sql, cn, adOpenStatic, adLockReadOnly, adCmdText if (rs.RecordCount) { lTransaction.managerName = rs.Fields("personName").Value + ""; } rs.Close(); sql = "SELECT POS_Name From POS WHERE (((POS.POSID)=" + lTransaction.posID + "));"; rs = modRecordSet.getRS(ref sql); //rs.Open sql, cn, adOpenStatic, adLockReadOnly, adCmdText if (rs.RecordCount) { lTransaction.posName = rs.Fields("POS_Name").Value + ""; } rs.Close(); //sql = "SELECT SaleItem.*, StockItem.StockItem_Name AS longName, StockItem.StockItem_ReceiptName AS receiptName, Catalogue.Catalogue_Barcode AS code,'Sale' as saleType FROM (StockItem INNER JOIN SaleItem ON StockItem.StockItemID = SaleItem.SaleItem_StockItemID) INNER JOIN Catalogue ON (Catalogue.Catalogue_Quantity = SaleItem.SaleItem_ShrinkQuantity) AND (SaleItem.SaleItem_StockItemID = Catalogue.Catalogue_StockItemID) WHERE (((SaleItem.SaleItem_DepositType)=0) AND ((SaleItem.SaleItem_SaleID)=" & lID & "))" //sql = sql & " UNION " //sql = sql & "SELECT SaleItem.*, Deposit.Deposit_Name AS longName, Deposit.Deposit_ReceiptName AS receiptName, Deposit.Deposit_Key AS code,'Deposit' as saleType FROM Deposit INNER JOIN SaleItem ON Deposit.DepositID = SaleItem.SaleItem_StockItemID WHERE (((SaleItem.SaleItem_DepositType)<>0) AND ((SaleItem.SaleItem_SaleID)=" & lID & "));" sql = "SELECT SaleItem.*, 'Sale' AS saleType From SaleItem Where (((SaleItem.SaleItem_DepositType) = 0) And ((SaleItem.SaleItem_SaleID) = " + lID + "))"; sql = sql + " UNION "; sql = sql + "SELECT SaleItem.*, 'Deposit' AS saleType From SaleItem WHERE (((SaleItem.SaleItem_DepositType)<>0) AND ((SaleItem.SaleItem_SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); while (!(rs.EOF)) { lLineitem = new lineItem(); lLineitem.build = 0; lLineitem.depositType = rs.Fields("SaleItem_DepositType").Value; lLineitem.id = rs.Fields("SaleItem_StockItemID").Value; lLineitem.lineNo = rs.Fields("SaleItem_LineNo").Value; lLineitem.originalPrice = rs.Fields("SaleItem_PriceOriginal").Value; lLineitem.price = rs.Fields("SaleItem_Price").Value; lLineitem.quantity = rs.Fields("SaleItem_Quantity").Value; lLineitem.reversal = rs.Fields("SaleItem_Reversal").Value; lLineitem.revoke = rs.Fields("SaleItem_Revoke").Value; lLineitem.setBuild = rs.Fields("SaleItem_SetID").Value; lLineitem.shrink = rs.Fields("SaleItem_ShrinkQuantity").Value; lLineitem.vat = rs.Fields("SaleItem_Vat").Value; lLineitem.transactionType = rs.Fields("SaleType").Value + ""; //lLineitem.code = rs("Code") & "" switch (lLineitem.depositType) { case 0: sql = "SELECT StockItem.StockItem_Name AS longName, StockItem.StockItem_ReceiptName AS receiptName From StockItem WHERE (((StockItemID)=" + rs.Fields("SaleItem_StockItemID").Value + "));"; rsItems = modRecordSet.getRS(ref sql); if (rsItems.RecordCount) { lLineitem.name = rs.Fields("SaleItem_ShrinkQuantity").Value + " x " + rsItems.Fields("longName").Value; lLineitem.receiptName = rs.Fields("SaleItem_ShrinkQuantity").Value + "x" + rsItems.Fields("receiptName").Value; } rsItems.Close(); sql = "SELECT Catalogue.Catalogue_Barcode AS code FROM Catalogue WHERE (Catalogue.Catalogue_Quantity = " + rs.Fields("SaleItem_ShrinkQuantity").Value + ") AND (Catalogue.Catalogue_StockItemID = " + rs.Fields("SaleItem_StockItemID").Value + ");"; rsItems = modRecordSet.getRS(ref sql); if (rsItems.RecordCount) { lLineitem.code = rsItems.Fields("Code").Value + ""; } rsItems.Close(); break; case 1: sql = "SELECT Deposit.Deposit_Name AS longName, Deposit.Deposit_ReceiptName AS receiptName, Deposit.Deposit_Key AS code From Deposit WHERE (((DepositID)=" + rs.Fields("SaleItem_StockItemID").Value + "));"; rsItems = modRecordSet.getRS(ref sql); if (rsItems.RecordCount) { lLineitem.name = rs.Fields("longName").Value + "-Unit"; lLineitem.receiptName = rs.Fields("receiptName").Value + "(U)"; lLineitem.code = rsItems.Fields("Code").Value + ""; } rsItems.Close(); break; case 2: sql = "SELECT Deposit.Deposit_Name AS longName, Deposit.Deposit_ReceiptName AS receiptName, Deposit.Deposit_Key AS code From Deposit WHERE (((DepositID)=" + rs.Fields("SaleItem_StockItemID").Value + "));"; rsItems = modRecordSet.getRS(ref sql); if (rsItems.RecordCount) { lLineitem.name = rs.Fields("longName").Value + "-Empty Crate"; lLineitem.receiptName = rs.Fields("receiptName").Value + "(E)"; lLineitem.code = rsItems.Fields("Code").Value + ""; } rsItems.Close(); break; case 3: sql = "SELECT Deposit.Deposit_Name AS longName, Deposit.Deposit_ReceiptName AS receiptName, Deposit.Deposit_Key AS code From Deposit WHERE (((DepositID)=" + rs.Fields("SaleItem_StockItemID").Value + "));"; rsItems = modRecordSet.getRS(ref sql); if (rsItems.RecordCount) { lLineitem.name = rs.Fields("longName").Value + "-Full Case"; lLineitem.receiptName = rs.Fields("receiptName").Value + "(F)"; lLineitem.code = rsItems.Fields("Code").Value + ""; } rsItems.Close(); break; } lTransaction.lineItems.Add(ref lLineitem); rs.MoveNext(); } rs.Close(); sql = "SELECT Customer.*, CustomerTransaction.* FROM (CustomerTransaction INNER JOIN Sale ON CustomerTransaction.CustomerTransaction_ReferenceID = Sale.SaleID) INNER JOIN Customer ON CustomerTransaction.CustomerTransaction_CustomerID = Customer.CustomerID WHERE (((Sale.SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.RecordCount) { lCustomer.channelID = lTransaction.channelID; lCustomer.creditLimit = rs.Fields("Customer_ChannelID").Value; lCustomer.department = rs.Fields("Customer_DepartmentName").Value + ""; lCustomer.fax = rs.Fields("Customer_Fax").Value + ""; lCustomer.Key = rs.Fields("CustomerID").Value; lCustomer.name = rs.Fields("Customer_InvoiceName").Value + ""; lCustomer.outstanding = 0; lCustomer.person = rs.Fields("Customer_FirstName").Value + " " + rs.Fields("Customer_Surname").Value; lCustomer.physical = rs.Fields("Customer_PhysicalAddress").Value + ""; lCustomer.postal = rs.Fields("Customer_PostalAddress").Value + ""; lCustomer.signed_Renamed = rs.Fields("CustomerTransaction_PersonName").Value; lCustomer.telephone = rs.Fields("Customer_Telephone").Value + ""; lCustomer.terms = Convert.ToInt16(rs.Fields("Customer_Terms").Value + ""); lCustomer.tax = rs.Fields("Customer_VatNumber").Value + ""; if (rs.Fields("CustomerTransaction_TransactionTypeID").Value == 3) { lTransaction.transactionType = "Payment"; lTransaction.paymentDiscount = 0; } lTransaction.customer_Renamed = lCustomer; } rs.Close(); sql = "SELECT Consignment.* FROM Consignment INNER JOIN Sale ON Consignment.Consignment_SaleID = Sale.SaleID WHERE (((Sale.SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.BOF & rs.EOF) { } else { lSpecial.address = rs.Fields("Consignment_Address").Value; lSpecial.mobile = rs.Fields("Consignment_Mobile").Value; lSpecial.name = rs.Fields("Consignment_Name").Value; lSpecial.quote = 0; lSpecial.saleID = lID; lSpecial.telephone = rs.Fields("Consignment_Number").Value; lSpecial.transactionType = "Consignment"; lTransaction.transactionSpecial_Renamed = lSpecial; } rs.Close(); sql = "SELECT Consignment.* FROM Consignment INNER JOIN Sale ON Consignment.Consignment_CompleteSaleID = Sale.SaleID WHERE (((Sale.SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.BOF & rs.EOF) { } else { lSpecial.address = rs.Fields("Consignment_Address").Value; lSpecial.mobile = rs.Fields("Consignment_Mobile").Value; lSpecial.name = rs.Fields("Consignment_Name").Value; lSpecial.quote = 0; lSpecial.saleID = lID; lSpecial.telephone = rs.Fields("Consignment_Number").Value; lSpecial.transactionType = "Consignment Complete"; lTransaction.transactionSpecial_Renamed = lSpecial; } printTransactionA4(ref lTransaction); } } else if (Convert.ToDouble(Strings.Split(this.lvTransaction.FocusedItem.Name, "_")[3]) == 3) { //payment //Dim Report As New cryPayment Report.Load("cryPayment.rpt"); rs = modRecordSet.getRS(ref "SELECT * FROM Company"); Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name")); if (Information.IsDBNull(rs.Fields("Company_PhysicalAddress").Value)) { } else { lAddress = Strings.Replace(rs.Fields("Company_PhysicalAddress").Value, Constants.vbCrLf, ", "); if (Strings.Right(lAddress, 2) == ", ") { lAddress = Strings.Left(lAddress, Strings.Len(lAddress) - 2); } } Report.SetParameterValue("txtCompanyDetails1", lAddress); if (Information.IsDBNull(rs.Fields("Company_Telephone").Value)) { } else { Report.SetParameterValue("txtCompanyDetails2", rs.Fields("Company_Telephone")); } if (Information.IsDBNull(rs.Fields("Company_TaxNumber").Value)) { } else { Report.SetParameterValue("txtCompanyDetails4", "TAX NO :" + rs.Fields("Company_TaxNumber").Value); } //If lTransaction.heading2 <> "" Then // Report.txtCompanyDetails2.SetText lTransaction.heading2 // If lTransaction.heading3 <> "" Then // Report.txtCompanyDetails3.SetText lTransaction.heading3 // // Else // If lTransaction.taxNumber <> "" Then // Report.txtCompanyDetails4.SetText "TAX NO :" & lTransaction.taxNumber // End If // End If //Else // If lTransaction.heading3 <> "" Then // Report.txtCompanyDetails2.SetText lTransaction.heading3 // Else // If lTransaction.taxNumber <> "" Then // Report.txtCompanyDetails2.SetText "TAX NO :" & lTransaction.taxNumber // End If // End If //End If rs.Close(); Report.SetParameterValue("txtCustomer", _txtFields_2.Text); if (!string.IsNullOrEmpty(_txtFields_6.Text)) { lArray = Strings.Split(_txtFields_6.Text, Constants.vbCrLf); Report.SetParameterValue("txtCustAddress1", lArray[0]); if (Information.UBound(lArray) >= 1) Report.SetParameterValue("txtCustAddress2", lArray[1]); if (Information.UBound(lArray) >= 2) Report.SetParameterValue("txtCustAddress3", lArray[2]); if (Information.UBound(lArray) >= 3) Report.SetParameterValue("txtCustAddress4", lArray[3]); } if (!string.IsNullOrEmpty(_txtFields_0.Text)) Report.SetParameterValue("txtCustAddress5", "TAX NO: " + _txtFields_0.Text); //If LCase(databaseName) = "pricing.mdb" Then // sql = "SELECT Sale.SaleID, POS.POS_Name, Person.Person_FirstName, Person.Person_LastName, Sale.Sale_Date, Sale.Sale_DatePOS, Sale.Sale_Reference, Sale.Sale_Total, Sale.Sale_Tender FROM (Sale INNER JOIN POS ON Sale.Sale_PosID = POS.POSID) INNER JOIN Person ON Sale.Sale_PersonID = Person.PersonID WHERE (((Sale.SaleID)=" & lID & "));" //Else // sql = "SELECT Sale.SaleID, POS.POS_Name, M_Person.Person_FirstName, M_Person.Person_LastName, Sale.Sale_Date, Sale.Sale_DatePOS, Sale.Sale_Reference, Sale.Sale_Total, Sale.Sale_Tender FROM (Sale INNER JOIN POS ON Sale.Sale_PosID = POS.POSID) INNER JOIN M_Person ON Sale.Sale_PersonID = M_Person.PersonID WHERE (((Sale.SaleID)=" & lID & "));" //End If //sql = "SELECT Sale.SaleID, POS.POS_Name, Person.Person_FirstName, Person.Person_LastName, Sale.Sale_Date, Sale.Sale_DatePOS, Sale.Sale_Reference, Sale.Sale_Total, Sale.Sale_Tender FROM (Sale INNER JOIN POS ON Sale.Sale_PosID = POS.POSID) INNER JOIN Person ON Sale.Sale_PersonID = Person.PersonID WHERE (((Sale.SaleID)=" & lID & "));" sql = "SELECT Sale.* From Sale WHERE (((SaleID)=" + lID + "));"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.RecordCount) { posID = rs.Fields("Sale_PosID").Value; personID = rs.Fields("Sale_PersonID").Value; Report.SetParameterValue("txtInvoiceNumber", rs.Fields("Sale_Reference")); Report.SetParameterValue("txtInvoiceDate", Strings.Format(rs.Fields("Sale_DatePOS").Value, "dd mmm yyyy hh:mm")); //Report.txtPOS.SetText rs("POS_Name") //Report.txtCashier.SetText rs("Person_FirstName") & rs("Person_LastName") Report.SetParameterValue("txtAmount", Strings.FormatNumber(rs.Fields("Sale_Total").Value, 2)); Report.SetParameterValue("txtChange", Strings.FormatNumber(rs.Fields("Sale_Tender").Value - rs.Fields("Sale_Total").Value, 2)); // lTransaction.paymentTotal - lTransaction.paymentTender, 2) Report.SetParameterValue("txtTender", Strings.FormatNumber(rs.Fields("Sale_Tender").Value, 2)); // lTransaction.paymentTender, 2) //Report.txtPaidBy.SetText lTransaction.customer.signed Report.ReportDefinition.Sections("txtPaidBy").SectionFormat.EnableSuppress = true; rs.Close(); sql = "SELECT [Person_FirstName] & ' ' & [Person_LastName] AS personName From Person WHERE (((PersonID)=" + personID + "));"; rs = modRecordSet.getRS(ref sql); if (rs.RecordCount) { Report.SetParameterValue("txtCashier", rs.Fields("personName").Value + ""); } rs.Close(); sql = "SELECT POS_Name From POS WHERE (((POS.POSID)=" + posID + "));"; rs = modRecordSet.getRS(ref sql); if (rs.RecordCount) { Report.SetParameterValue("txtPOS", rs.Fields("POS_Name").Value + ""); } rs.Close(); sql = "SELECT CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_ReferenceID From CustomerTransaction WHERE (((CustomerTransaction.CustomerTransaction_TransactionTypeID)=8) AND ((CustomerTransaction.CustomerTransaction_ReferenceID)=" + lID + "));"; Debug.Print(sql); rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rs.RecordCount) { Report.SetParameterValue("txtSettlement", Strings.FormatNumber(rs.Fields("CustomerTransaction_Amount").Value, 2)); } else { Report.SetParameterValue("txtSettlement", Strings.FormatNumber("0.00", 2)); } My.MyProject.Forms.frmReportShow.Text = "Customer Statement"; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); } else { ReportNone.Load("cryNoRecords.rpt"); ReportNone.SetParameterValue("txtCompanyName", rs.Fields("Company_Name")); ReportNone.SetParameterValue("txtTitle", "Customer Statement"); //UPGRADE_WARNING: Couldn't resolve default property of object ReportNone.txtTitle. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone; My.MyProject.Forms.frmReportShow.mReport = ReportNone; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); return; } } }
private void cmdNew_Click(System.Object eventSender, System.EventArgs eventArgs) { ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rsBClabel = default(ADODB.Recordset); ADODB.Recordset rst = default(ADODB.Recordset); short TheLastIDIncr = 0; short BCLabelIDIncr = 0; ADODB.Recordset rsNewName = default(ADODB.Recordset); ADODB.Recordset rsForName = default(ADODB.Recordset); string InpType = null; short x = 0; rs = new ADODB.Recordset(); rsBClabel = new ADODB.Recordset(); rst = new ADODB.Recordset(); rsNewName = new ADODB.Recordset(); rsForName = new ADODB.Recordset(); //Set rs = getRS("SELECT Max(BClabel_LabelID) as TheMaxLabelID FROM BClabel") //***** If BClabel and BClabelItem tables are empty then insert all data from LabelItem //If IsNull(rs("TheMaxLabelID")) Then // IntDesign1 = 2 // DataList1_DblClick // Exit Sub //End If rs = modRecordSet.getRS(ref "SELECT Max(LabelID) as TheMaxLabelID FROM Label;"); if (Information.IsDBNull(rs.Fields("TheMaxLabelID").Value)) { modApplication.IntDesign1 = 2; DataList1_DblClick(DataList1, new System.EventArgs()); return; } TheLastIDIncr = rs.Fields("TheMaxLabelID").Value + 1; //LabelID rst = modRecordSet.getRS(ref "SELECT Max(BClabelID) as TheMaxBClabelID FROM BClabel"); if (Information.IsDBNull(rst.Fields("TheMaxBClabelID").Value)) { BCLabelIDIncr = 1; } else { BCLabelIDIncr = rst.Fields("TheMaxBClabelID").Value + 1; //BCLabelID } if (option1[1].Checked == true) { InpType = Convert.ToString(1); } else if (option1[2].Checked == true) { InpType = Convert.ToString(2); } else { InpType = Interaction.InputBox("Please enter 1 for New Shelf Talker Design OR 2 for New Barcode Design."); if (!Information.IsNumeric(InpType)) { //MsgBox "Please enter 1 for New Shelf Talker Design OR 2 for New Barcode Design.", vbInformation, App.title return; } else if (Convert.ToDouble(InpType) == 1) { modApplication.TheType = 1; } else if (Convert.ToDouble(InpType) == 2) { modApplication.TheType = 2; } else { Interaction.MsgBox("Please enter 1 for New Shelf Talker Design OR 2 for New Barcode Design.", MsgBoxStyle.Information, _4PosBackOffice.NET.My.MyProject.Application.Info.Title); return; } } //**** //New Label Name //**** x = x + 1; modApplication.NewLabelName = "New Label" + x; rsNewName = modRecordSet.getRS(ref "SELECT * FROM Label WHERE Label_Name='" + modApplication.NewLabelName + "'"); rsForName = modRecordSet.getRS(ref "SELECT * FROM Label"); if (rsNewName.RecordCount > 0) { //******* //Do until New Name not found //******* while (!(rsForName.EOF)) { //**** //If New Label Name not found then add 1 to last Label No //**** if (rsNewName.RecordCount > 0) { x = x + 1; modApplication.NewLabelName = "New Label" + x; rsNewName = modRecordSet.getRS(ref "SELECT * FROM Label WHERE Label_Name='" + modApplication.NewLabelName + "'"); } else if (rsNewName.RecordCount < 1) { modApplication.NewLabelName = modApplication.NewLabelName; break; // TODO: might not be correct. Was : Exit Do } rsForName.moveNext(); } } else { } x = 0; //***** //Inserting New Label //***** rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabel(BClabelID,BClabel_Name,BClabel_Type,BClabel_Disabled,BClabel_Height,BClabel_LabelID)VALUES(" + BCLabelIDIncr + " ,'Stock','Stock','" + 0 + "',15," + TheLastIDIncr + ")"); rsBClabel = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + BCLabelIDIncr + "," + 22 + ",'blank'," + 1 + "," + 0 + ",'" + 0 + "',' ','" + 0 + "'," + TheLastIDIncr + ")"); rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabel_LabelID = BClabelItem.BClabelItem_LabelID WHERE BClabelItem.BClabelItem_LabelID=" + TheLastIDIncr + ""); rsBClabel = modRecordSet.getRS(ref "INSERT INTO Label(LabelID,Label_Type,Label_Name,Label_Height,Label_Width,Label_Top,Label_Rotate,Label_Disabled,Label_Left)VALUES(" + TheLastIDIncr + "," + modApplication.TheType + ",'" + modApplication.NewLabelName + "'," + 30 + "," + 40 + "," + 0 + ",'" + 0 + "','" + 0 + "'," + 0 + ")"); rsBClabel = modRecordSet.getRS(ref "INSERT INTO LabelItem(labelItem_LabelID,labelItem_Line,labelItem_Field,labelItem_Align,labelItem_Size,labelItem_Bold,labelItem_Sample) VALUES (" + TheLastIDIncr + "," + 22 + ",'blank'," + 1 + "," + 0 + ",'" + 0 + "',' ')"); modApplication.RecSel = rs.Fields("BClabelID").Value; //SelectLabelName = NewLabelName modApplication.MyLIDWHole = TheLastIDIncr; My.MyProject.Forms.frmBarcodeLoad.ShowDialog(); }
public void loadItem(ref int id) { int blCust = 0; int ctSelling = 0; bool visable = false; ADODB.Recordset rsProp = default(ADODB.Recordset); loading = true; ADODB.Recordset rsChannel = default(ADODB.Recordset); ADODB.Recordset rsQuantity = default(ADODB.Recordset); ADODB.Recordset rs = default(ADODB.Recordset); string sql = null; short x = 0; decimal lQuantity = default(decimal); decimal lDepositQuantity = default(decimal); decimal lCost = default(decimal); decimal lActualCost = default(decimal); decimal lDepositUnit = default(decimal); decimal lDepositPack = default(decimal); sql = "INSERT INTO Catalogue ( Catalogue_StockItemID, Catalogue_Quantity, Catalogue_Barcode, Catalogue_Deposit, Catalogue_Content, Catalogue_Disabled ) "; sql = sql + "SELECT theJoin.StockItemID, theJoin.ShrinkItem_Quantity, 'CODE' AS Expr1, 0 AS deposit, 0 AS content, 0 AS disabled FROM [SELECT StockItem.StockItemID, ShrinkItem.ShrinkItem_Quantity FROM ShrinkItem INNER JOIN "; sql = sql + "StockItem ON ShrinkItem.ShrinkItem_ShrinkID = StockItem.StockItem_ShrinkID]. AS theJoin LEFT JOIN Catalogue ON (theJoin.ShrinkItem_Quantity = Catalogue.Catalogue_Quantity) AND (theJoin.StockItemID = Catalogue.Catalogue_StockItemID) "; sql = sql + "WHERE (((theJoin.StockItemID)=" + id + ") AND ((Catalogue.Catalogue_StockItemID) Is Null));"; modRecordSet.cnnDB.Execute(sql); sql = "SELECT StockItem.StockItemID, StockItem.StockItem_PackSizeID, StockItem.StockItem_Name, StockItem.StockItem_Quantity, StockItem.StockItem_ListCost, StockItem.StockItem_ActualCost, StockItem.StockItem_PriceSetID, Deposit.Deposit_UnitCost, Deposit.Deposit_CaseCost, Vat.Vat_Amount, Supplier.Supplier_Name, PricingGroup.PricingGroupID, PricingGroup.PricingGroup_Name, PricingGroup.PricingGroup_RemoveCents, PricingGroup.PricingGroup_RoundAfter, PricingGroup.PricingGroup_RoundDown, PricingGroup.PricingGroup_Unit1, PricingGroup.PricingGroup_Case1, PricingGroup.PricingGroup_Unit2, PricingGroup.PricingGroup_Case2, PricingGroup.PricingGroup_Unit3, PricingGroup.PricingGroup_Case3, PricingGroup.PricingGroup_Unit4, PricingGroup.PricingGroup_Case4, PricingGroup.PricingGroup_Unit5, PricingGroup.PricingGroup_Case5, PricingGroup.PricingGroup_Unit6, PricingGroup.PricingGroup_Case6, PricingGroup.PricingGroup_Unit7, PricingGroup.PricingGroup_Case7, PricingGroup.PricingGroup_Unit8, PricingGroup.PricingGroup_Case8 "; sql = sql + "FROM (((StockItem INNER JOIN Vat ON StockItem.StockItem_VatID = Vat.VatID) INNER JOIN Deposit ON StockItem.StockItem_DepositID = Deposit.DepositID) INNER JOIN PricingGroup ON StockItem.StockItem_PricingGroupID = PricingGroup.PricingGroupID) INNER JOIN Supplier ON StockItem.StockItem_SupplierID = Supplier.SupplierID WHERE (((StockItem.StockItemID)=" + id + "));"; rsStockItem = modRecordSet.getRS(ref sql); rsChannel = modRecordSet.getRS(ref "SELECT ChannelID, Channel_Name From Channel WHERE (Channel_Disabled = 0) AND (ChannelID <> 9) ORDER BY ChannelID"); rsQuantity = modRecordSet.getRS(ref "SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode, Catalogue.Catalogue_Deposit, Catalogue.Catalogue_Content, Catalogue.Catalogue_Disabled, ShrinkItem.ShrinkItem_Code FROM Catalogue INNER JOIN (StockItem INNER JOIN ShrinkItem ON StockItem.StockItem_ShrinkID = ShrinkItem.ShrinkItem_ShrinkID) ON (ShrinkItem.ShrinkItem_Quantity = Catalogue.Catalogue_Quantity) AND (Catalogue.Catalogue_StockItemID = StockItem.StockItemID) Where (((Catalogue.Catalogue_StockItemID) = " + id + ")) ORDER BY Catalogue.Catalogue_Quantity;"); rsProp = modRecordSet.getRS(ref "SELECT PropChannelLnk.PropChannelLnk_Quantity, PropChannelLnk.PropChannelLnk_ChannelID, PropChannelLnk.PropChannelLnk_Markup From PropChannelLnk WHERE (((PropChannelLnk.PropChannelLnk_StockItemID)=" + id + "));"); //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"' if (Information.IsDBNull(rsStockItem.Fields("StockItem_PriceSetID").Value)) { } else { rs = modRecordSet.getRS(ref "SELECT PriceSet.PriceSetID, [PriceSet_Name] & '(' & [StockItem_Name] & ')' AS priceSet_FullName, PriceSet.PriceSet_StockItemID FROM StockItem INNER JOIN PriceSet ON StockItem.StockItem_PriceSetID = PriceSet.PriceSetID WHERE (((StockItem.StockItemID)=" + id + ") AND ((PriceSet.PriceSet_Disabled)=0));"); if (rs.RecordCount) { if (rs.Fields("PriceSet_StockItemID").Value == id) { lblPriceSet.Text = "Primary Pricing Set Item"; lblPriceSet.Visible = true; lblPriceSet.BackColor = System.Drawing.Color.Red; lblPriceSet.ForeColor = System.Drawing.Color.White; } else { _txtProp_0.Enabled = false; _txtPrice_0.Enabled = false; lblPriceSet.Text = "Child Pricing Set Item"; lblPriceSet.Visible = true; lblPriceSet.BackColor = System.Drawing.Color.Yellow; lblPriceSet.ForeColor = System.Drawing.Color.Black; } } } saveData(); if (rsStockItem.BOF | rsStockItem.EOF) { } else { gStockItemID = id; gChannelID = 0; _txtCost_0.Enabled = false; // _txtVariableCost_0.Enabled = False _txtCost_0.BackColor = System.Drawing.ColorTranslator.FromOle(-2147483633); _txtVariableCost_0.BackColor = System.Drawing.ColorTranslator.FromOle(-2147483633); for (x = 0; x <= frmItem.Count - 1; x++) { //txtCost.Unload(x) //lblMatrix.Unload(x) //txtProp.Unload(x) //lblDepositUnit.Unload(x) //lblDepositPack.Unload(x) //lblVat.Unload(x) //lblMarkup.Unload(x) //lblGP.Unload(x) //txtPrice.Unload(x) //lblPrice.Unload(x) //lblPercent.Unload(x) //lnProfit.Unload(x)) //txtVariableCost.Unload(x) //lblProfitAmount.Unload(x) //lblProfitPrecent.Unload(x) //lblSection.Unload(x) //frmItem.Unload(x) //lblGPActual.Unload(x) } lblVatName.Text = "VAT at " + Strings.FormatNumber(rsStockItem.Fields("Vat_Amount").Value, 2) + "%"; gVAT = 1 + rsStockItem.Fields("Vat_Amount").Value / 100; gRoundAfter = 0; gRemoveUnits = 0; gRoundDownUnits = 0; gRoundAfter = rsStockItem.Fields("PricingGroup_RoundAfter").Value; gRemoveUnits = rsStockItem.Fields("PricingGroup_RemoveCents").Value; gRoundDownUnits = rsStockItem.Fields("PricingGroup_RoundDown").Value; lblPricingGroup.Text = rsStockItem.Fields("PricingGroup_Name").Value; lblPricingGroup.Tag = rsStockItem.Fields("PricingGroupID").Value; lblPricingGroupRule.Text = " When a Stock Item value is over " + Strings.FormatNumber(gRoundAfter, 2) + " round all amounts below " + gRoundDownUnits + " cents to the lower Rand value, else the amount is rounded to the next highest Rand, then remove " + gRemoveUnits + " cents from the rounded stock item Rand value."; lblPricingGroupRule.Tag = lblPricingGroupRule.Text; lblStockItemName.Text = rsStockItem.Fields("StockItem_Name").Value; lCost = rsStockItem.Fields("StockItem_ListCost").Value; lActualCost = rsStockItem.Fields("StockItem_ActualCost").Value; lQuantity = rsStockItem.Fields("StockItem_Quantity").Value; lDepositUnit = rsStockItem.Fields("Deposit_UnitCost").Value; lDepositPack = rsStockItem.Fields("Deposit_CaseCost").Value; lDepositQuantity = lQuantity; x = -1; while (!(rsQuantity.EOF)) { x = x + 1; //UPGRADE_WARNING: Couldn't resolve default property of object x. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' if (x) { //frmItem.Load(x) //UPGRADE_WARNING: Couldn't resolve default property of object x. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' frmItem[x].Left = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(frmItem[0].Left, true) + (sizeConvertors.pixelToTwips(frmItem[0].Width, true) + 100) * x, true); frmItem[x].Visible = true; //loadControl(txtCost, x) //loadControl(lblMatrix, x) //loadControl(picLine, x) //loadControl(txtProp, x) //loadControl(lblDepositUnit, x) //loadControl(lblDepositPack, x) //loadControl(lblVat, x) //loadControl(lblMarkup, x) //loadControl(lblGP, x) //loadControl(txtPrice, x) //loadControl(lblPrice, x) //loadControl(lblPercent, x) //loadControl(lnProfit, x) //loadControl(txtVariableCost, x) //loadControl(lblProfitAmount, x) //loadControl(lblProfitPrecent, x) //loadControl(lblSection, x) //loadControl(lblGPActual, x) } _lblSection_0.BackColor = System.Drawing.ColorTranslator.FromOle(65280); _lblSection_0.Text = "Matrix"; _frmItem_0.Text = rsQuantity.Fields("ShrinkItem_Code").Value + " (" + rsQuantity.Fields("Catalogue_Quantity").Value + ")"; _frmItem_0.Tag = rsQuantity.Fields("Catalogue_Quantity").Value; _lblDepositUnit_0.Text = Strings.FormatNumber(Convert.ToDouble(frmItem[x].Tag) * lDepositUnit, 2); if (lDepositQuantity) { _lblDepositPack_0.Text = Strings.FormatNumber(Convert.ToInt16(Convert.ToDouble(frmItem[x].Tag) / lDepositQuantity - 0.49) * lDepositPack, 2); } else { _lblDepositPack_0.Text = "0.00"; } _txtCost_0.Text = Strings.FormatNumber(lCost / lQuantity * Convert.ToDouble(frmItem[x].Tag), 2); _txtCost_0.Tag = _txtCost_0.Text; _txtVariableCost_0.Text = Strings.FormatNumber(lActualCost / lQuantity * Convert.ToDouble(frmItem[x].Tag), 2); _txtVariableCost_0.Tag = _txtVariableCost_0.Text; if (lQuantity == Convert.ToDouble(_frmItem_0.Tag)) { _txtCost_0.Enabled = true; _txtCost_0.BackColor = System.Drawing.Color.White; //_txtVariableCost_0.Enabled = True _txtVariableCost_0.BackColor = System.Drawing.Color.White; } rsQuantity.MoveNext(); } if (x < 3) x = 3; this.Width = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(frmItem[0].Left, true) + (x + 1) * (sizeConvertors.pixelToTwips(frmItem[0].Width, true) + 100) + 250, true); this.lblPricingGroupRule.Width = sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(this.Width, true) - sizeConvertors.pixelToTwips(this.lblPricingGroupRule.Left, true) - 250 - 100, true); cmbChannel.Items.Clear(); while (!(rsChannel.EOF)) { cmbChannel.Items.Add(new LBI(rsChannel.Fields("Channel_Name").Value, rsChannel.Fields("ChannelID").Value)); rsChannel.MoveNext(); } cmbChannel.SelectedIndex = 0; gChannelID = Convert.ToInt32(cmbChannel.SelectedIndex); doChannel(); if (visable) _txtProp_0.Focus(); } loadLanguage(); loading = false; if (blCust == true) { _txtPrice_0.Text = Strings.FormatNumber(ctSelling, 2); blCust = false; } }
private void doSearch() { string sql = null; string lString = null; System.Windows.Forms.ListViewItem lLI = null; gRS = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Name, CashTransaction.CashTransaction_StockItemID, CashTransaction.CashTransaction_Shrink, StockItem.StockItem_PriceSetID, CashTransaction.CashTransaction_Type, CashTransaction_Amount FROM CashTransaction INNER JOIN StockItem ON CashTransaction.CashTransaction_StockItemID = StockItem.StockItemID ORDER BY StockItem.StockItem_Name;"); //Display the list of Titles in the DataCombo lvItem.Items.Clear(); while (!(gRS.EOF)) { lLI = lvItem.Items.Add(gRS.Fields("CashTransaction_StockItemID").Value + "_" + gRS.Fields("CashTransaction_Shrink").Value, gRS.Fields("StockItem_Name").Value, ""); //UPGRADE_WARNING: Lower bound of collection lLI has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' if (lLI.SubItems.Count > 1) { lLI.SubItems[1].Text = gRS.Fields("CashTransaction_Shrink").Value; } else { lLI.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, gRS.Fields("CashTransaction_Shrink").Value)); } //UPGRADE_WARNING: Lower bound of collection lLI has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"' if (lLI.SubItems.Count > 2) { lLI.SubItems[2].Text = Strings.FormatNumber(gRS.Fields("CashTransaction_Amount").Value, 2); } else { lLI.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(gRS.Fields("CashTransaction_Amount").Value, 2))); } gRS.moveNext(); } }
public void loadItem(ref int id) { System.Windows.Forms.TextBox oText = null; System.Windows.Forms.CheckBox oCheck = null; // ERROR: Not supported in C#: OnErrorStatement gLoading = false; if (id) { //checkcustid = id adoPrimaryRS = modRecordSet.getRS(ref "select * from Customer WHERE CustomerID = " + id); cmbTerms.SelectedIndex = adoPrimaryRS.Fields("Customer_Terms").Value; mbAddNewFlag = false; } else { //Set adoPrimaryRS = getRS("select * from Customer") //adoPrimaryRS.AddNew //Me.Caption = Me.Caption & " [New record]" //mbAddNewFlag = True //cmbTerms.ListIndex = 0 //Me.cmbChannel.BoundText = 0 } // If adoPrimaryRS.BOF Or adoPrimaryRS.EOF Then // Else foreach (TextBox oText_loopVariable in txtFields) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize; } // For Each oText In Me.txtInteger // Set oText.DataBindings.Add(adoPrimaryRS) // txtInteger_LostFocus oText.Index // Next foreach (TextBox oText_loopVariable in this.txtFloat) { oText = oText_loopVariable; oText.DataBindings.Add(adoPrimaryRS); if (string.IsNullOrEmpty(oText.Text)) oText.Text = "0"; oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100); oText.Leave += txtFloat_Leave; //txtFloat_Leave(txtFloat.Item((oText.Index)), New System.EventArgs()) } //Bind the check boxes to the data provider foreach (CheckBox oCheck_loopVariable in this.chkFields) { oCheck = oCheck_loopVariable; oCheck.DataBindings.Add(adoPrimaryRS); } cmbTerms.DataSource = adoPrimaryRS; buildDataControls(); mbDataChanged = false; if (mbAddNewFlag == true) { foreach (CheckBox oCheck_loopVariable in this.chkFields) { oCheck = oCheck_loopVariable; oCheck.CheckState = System.Windows.Forms.CheckState.Unchecked; } cmbChannel.BoundText = "1"; } loadData(); loadLanguage(); ShowDialog(); // End If }
//Handles gridItem.EnterCell private void gridItem_EnterCell(System.Object eventSender, System.EventArgs eventArgs) { // ERROR: Not supported in C#: OnErrorStatement if (loading) return; loading = true; var _with6 = gridItem; if (_with6.row) { if (_with6.Col == colContentExclusive) { _txtEdit_1.SetBounds(sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Left, true) + _with6.CellLeft, true), sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Top, false) + _with6.CellTop, false), sizeConvertors.twipsToPixels(_with6.CellWidth, true), sizeConvertors.twipsToPixels(_with6.CellHeight, false)); _txtEdit_1.Text = _with6.Text; _txtEdit_1.Tag = _txtEdit_1.Text; _txtEdit_1.Visible = true; _txtEdit_1.SelectionStart = 0; _txtEdit_1.SelectionLength = 9999; if (this.Visible) _txtEdit_1.Focus(); } else { _txtEdit_1.Visible = false; } if (_with6.Col == colPrice) { if (Convert.ToInt16(_with6.Text) == 0) { Interaction.MsgBox("Matrix Selling price cannot be changed!", MsgBoxStyle.Critical); loading = false; txtSearch.Focus(); return; } _txtEdit_2.SetBounds(sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Left, true) + _with6.CellLeft, true), sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Top, false) + _with6.CellTop, false), sizeConvertors.twipsToPixels(_with6.CellWidth, true), sizeConvertors.twipsToPixels(_with6.CellHeight, false)); _txtEdit_2.Text = _with6.Text; _txtEdit_2.Tag = _txtEdit_2.Text; _txtEdit_2.Visible = true; _txtEdit_2.SelectionStart = 0; _txtEdit_2.SelectionLength = 9999; if (this.Visible) _txtEdit_2.Focus(); } else { _txtEdit_2.Visible = false; } if (_with6.Col == colQuantity) { _txtEdit_0.SetBounds(sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Left, true) + _with6.CellLeft, true), sizeConvertors.twipsToPixels(sizeConvertors.pixelToTwips(_with6.Top, false) + _with6.CellTop, false), sizeConvertors.twipsToPixels(_with6.CellWidth, true), sizeConvertors.twipsToPixels(_with6.CellHeight, false)); _txtEdit_0.Text = _with6.Text; modApplication.intQTY = Convert.ToInt16(_with6.Text); _txtEdit_0.Tag = _txtEdit_0.Text; _txtEdit_0.Visible = true; _txtEdit_0.SelectionStart = 0; _txtEdit_0.SelectionLength = 9999; if (this.Visible) _txtEdit_0.Focus(); } else { _txtEdit_0.Visible = false; } } loading = false; if (bFNVegPackSize & orderType == 0) { //Set rsPackSize = getRS("SELECT StockItem.StockItemID, PackSize.PackSize_Volume FROM StockItem INNER JOIN PackSize ON StockItem.StockItem_PackSizeID = PackSize.PackSizeID WHERE (((StockItem.StockItemID)=" & gridItem.RowData(gridItem.row) & "));") rsPackSize = modRecordSet.getRS(ref "SELECT GRVItem.GRVItem_PackSizeVol FROM GRVItem WHERE (((GRVItem.GRVItem_GRVID)=" + My.MyProject.Forms.frmGRV.adoPrimaryRS.Fields("GRVID").Value + ") AND ((GRVItem.GRVItem_StockItemID)=" + gridItem.get_RowData(ref gridItem.row) + ") AND ((GRVItem.GRVItem_Return)=" + orderType + "));"); txtPackSize.Text = Strings.FormatNumber(rsPackSize.Fields("GRVItem_PackSizeVol").Value, 2); } return; gridItem_Err: // ERROR: Not supported in C#: ResumeStatement }
private void cmdsearch_Click_Alloc() { int x = 0; string sql = null; string databaseName = null; short y = 0; short lMonth = 0; ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rs = new ADODB.Recordset(); bSelectPayment = false; if (gLoading) return; gLoading = true; Cursor = System.Windows.Forms.Cursors.WaitCursor; System.Windows.Forms.Application.DoEvents(); //lMonth = cmbMonth.ItemData(cmbMonth.ListIndex) //If lMonth = gMonthEnd Then databaseName = "pricing.mdb"; //Else // databaseName = "Month" & lMonth & ".mdb" //End If //Set cn = openConnectionInstance(databaseName) //If cn Is Nothing Then // Exit Sub //End If string lString = null; sql = "SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName, CustomerTransaction.CustomerTransaction_Main, CustomerTransaction.CustomerTransaction_Child, CustomerTransaction.CustomerTransaction_Allocated," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + adoPrimaryRS.Fields("CustomerID").Value + ")) ORDER BY CustomerTransaction.CustomerTransactionID DESC;"; Debug.Print(sql); //rs.Open sql, cnnDB, adOpenStatic, adLockReadOnly, adCmdText rs = modRecordSet.getRS(ref sql); lvTransAlloc.Items.Clear(); lblcount.Text = "0 of 0"; System.Windows.Forms.ListViewItem lvItemAlloc = null; x = 0; lvTransAlloc.Visible = false; while (!(rs.EOF)) { x = x + 1; if (gLoading) { } else { break; // TODO: might not be correct. Was : Exit Do } lblcount.Text = x + " of " + rs.RecordCount; System.Windows.Forms.Application.DoEvents(); //If rs("CustomerTransaction_Reference") = "Month End" Then if (rs.Fields("TransactionType_Name").Value == "B/Forward") { if ((Information.IsDBNull(rs.Fields("debit").Value) ? 0 : rs.Fields("debit").Value) == rs.Fields("CustomerTransaction_Allocated").Value & (Information.IsDBNull(rs.Fields("credit").Value) ? 0 : rs.Fields("credit").Value) == 0) { //Else lvItemAlloc = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItemAlloc.SubItems.Count > 1) { lvItemAlloc.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItemAlloc.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItemAlloc.SubItems.Count > 2) { lvItemAlloc.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItemAlloc.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } //Select Case rs("Sale_PaymentType") // Case 1 // lvItemAlloc.SubItems(2) = "Cash" // Case 2 // lvItemAlloc.SubItems(2) = "CR Card" // Case 3 // lvItemAlloc.SubItems(2) = "DR Card" // Case 4 // lvItemAlloc.SubItems(2) = "Cheque" // Case 5 // lvItemAlloc.SubItems(2) = "Account" // Case 7 // lvItemAlloc.SubItems(2) = "Split Tender" // Case Else // lvItemAlloc.SubItems(2) = "Cash" //End Select if (lvItemAlloc.SubItems.Count > 3) { lvItemAlloc.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItemAlloc.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 4) { lvItemAlloc.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItemAlloc.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 5) { lvItemAlloc.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4); } else { lvItemAlloc.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4))); } } } else if (rs.Fields("TransactionType_Name").Value == "Invoice") { if ((Information.IsDBNull(rs.Fields("debit").Value) ? 0 : rs.Fields("debit").Value) == rs.Fields("CustomerTransaction_Allocated").Value & (Information.IsDBNull(rs.Fields("credit").Value) ? 0 : rs.Fields("credit").Value) == 0) { //Else lvItemAlloc = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItemAlloc.SubItems.Count > 1) { lvItemAlloc.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItemAlloc.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItemAlloc.SubItems.Count > 2) { lvItemAlloc.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItemAlloc.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItemAlloc.SubItems.Count > 3) { lvItemAlloc.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItemAlloc.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 4) { lvItemAlloc.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItemAlloc.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 5) { lvItemAlloc.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4); } else { lvItemAlloc.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4))); } } } else if (rs.Fields("TransactionType_Name").Value == "Interest") { if ((Information.IsDBNull(rs.Fields("debit").Value) ? 0 : rs.Fields("debit").Value) == rs.Fields("CustomerTransaction_Allocated").Value & (Information.IsDBNull(rs.Fields("credit").Value) ? 0 : rs.Fields("credit").Value) == 0) { //Else lvItemAlloc = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItemAlloc.SubItems.Count > 1) { lvItemAlloc.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItemAlloc.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItemAlloc.SubItems.Count > 2) { lvItemAlloc.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItemAlloc.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItemAlloc.SubItems.Count > 3) { lvItemAlloc.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItemAlloc.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 4) { lvItemAlloc.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItemAlloc.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 5) { lvItemAlloc.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4); } else { lvItemAlloc.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4))); } } } else if (rs.Fields("TransactionType_Name").Value == "Debit Journal") { if ((Information.IsDBNull(rs.Fields("debit").Value) ? 0 : rs.Fields("debit").Value) == rs.Fields("CustomerTransaction_Allocated").Value) { //Else lvItemAlloc = lvTransAlloc.Items.Add("K" + rs.Fields("CustomerTransactionID").Value + "_" + databaseName + "_" + rs.Fields("CustomerTransaction_ReferenceID").Value + "_" + rs.Fields("CustomerTransaction_TransactionTypeID").Value, Strings.Format(rs.Fields("CustomerTransaction_Date").Value, "yyyy mmm dd hh:mm"), ""); if (lvItemAlloc.SubItems.Count > 1) { lvItemAlloc.SubItems[1].Text = rs.Fields("CustomerTransaction_Reference").Value; } else { lvItemAlloc.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("CustomerTransaction_Reference").Value)); } if (lvItemAlloc.SubItems.Count > 2) { lvItemAlloc.SubItems[2].Text = rs.Fields("TransactionType_Name").Value; } else { lvItemAlloc.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, rs.Fields("TransactionType_Name").Value)); } if (lvItemAlloc.SubItems.Count > 3) { lvItemAlloc.SubItems[3].Text = Strings.FormatNumber(rs.Fields("debit").Value, 4); } else { lvItemAlloc.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("debit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 4) { lvItemAlloc.SubItems[4].Text = Strings.FormatNumber(rs.Fields("credit").Value, 4); } else { lvItemAlloc.SubItems.Insert(4, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("credit").Value, 4))); } if (lvItemAlloc.SubItems.Count > 5) { lvItemAlloc.SubItems[5].Text = Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4); } else { lvItemAlloc.SubItems.Insert(5, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, Strings.FormatNumber(rs.Fields("CustomerTransaction_Allocated").Value, 4))); } } } rs.moveNext(); } lvTransAlloc.Visible = true; //lvTransAlloc.Refresh Cursor = System.Windows.Forms.Cursors.Default; gLoading = false; }
public void loadItem(ref bool returns) { System.Windows.Forms.TextBox oText = new System.Windows.Forms.TextBox(); //ResizeForm frmGRVitem, frmGRVitem.Width, frmGRVitem.Height, 2 if (returns) { orderType = 1; } else { orderType = 0; } loading = true; setupGRV(); getNamespace(); getOrder(); if (gridItem.RowCount) { loading = true; gridItem.Col = 0; gridItem.row = 0; loading = false; foreach (TextBox oText_loopVariable in txtEdit) { oText = oText_loopVariable; oText.Visible = false; } if (gridItem.RowCount > 1) { gridItem.Col = colQuantity; gridItem.row = 1; _txtEdit_0.Visible = true; } else { } } loading = false; cmdSort.Left = 0; cmdStockItem.Left = 0; if (modApplication.bolAirTimeGRV == true) { tmrAutoGRV.Enabled = true; } rsPackSize = modRecordSet.getRS(ref "SELECT Company_FNVegShowVol FROM Company;"); bFNVegPackSize = rsPackSize.Fields("Company_FNVegShowVol").Value; //update TotalQtyKG modRecordSet.cnnDB.Execute("UPDATE (GRVItem INNER JOIN StockItem ON GRVItem.GRVItem_StockItemID = StockItem.StockItemID) INNER JOIN PackSize ON StockItem.StockItem_PackSizeID = PackSize.PackSizeID SET GRVItem_PackSizeVol=IIf(GRVItem_PackSizeVol=0,PackSize.PackSize_Volume,GRVItem_PackSizeVol) WHERE (((GRVItem.GRVItem_GRVID)=" + My.MyProject.Forms.frmGRV.adoPrimaryRS.Fields("GRVID").Value + "));"); loadLanguage(); if (this.Visible) { } else { this.ShowDialog(); } }
public void UpdateCatalogID(ref string st_Name) { string strFldName = null; string strIn = null; ADODB.Recordset rj = default(ADODB.Recordset); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rID = default(ADODB.Recordset); //Set rID = getRS("SELECT * FROM " & st_Name) //Do While rID.EOF = False // If prgUpdate.value = prgUpdate.Max Then // prgUpdate.value = 0 // Else // prgUpdate.value = prgUpdate.value + 1 // End If // 'rID("Handheld_Barcode") = 0 // rID("HandHeldID") = 0 // rID.update '"HandHeldID", 0 // rID.moveNext //Loop strIn = "UPDATE " + st_Name + " SET HandHeldID = 0 WHERE Quantity > 0;"; modRecordSet.cnnDB.Execute(strIn); rj = modRecordSet.getRS(ref "SELECT * FROM " + st_Name); while (rj.EOF == false) { //If prgUpdate.value = prgUpdate.Max Then // prgUpdate.value = 0 //Else // prgUpdate.value = prgUpdate.value + 1 //End If //Set rs = getRS("SELECT * FROM Catalogue WHERE Catalogue_Barcode = '" & rj("Handheld_Barcode") & "'") rs = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Disabled, StockItem.StockItem_Discontinued, * FROM Catalogue INNER JOIN StockItem ON Catalogue.Catalogue_StockItemID = StockItem.StockItemID WHERE (((Catalogue.Catalogue_Barcode)='" + rj.Fields("Barcodes").Value + "') AND ((StockItem.StockItem_Disabled)=False) AND ((StockItem.StockItem_Discontinued)=False));"); if (rs.RecordCount > 0) modRecordSet.cnnDB.Execute("UPDATE " + st_Name + " SET HandHeldID = " + rs.Fields("Catalogue_StockItemID").Value + ", Quantity = " + (rj.Fields("Quantity").Value * rs.Fields("Catalogue_Quantity").Value) + " WHERE Barcodes = '" + rj.Fields("Barcodes").Value + "'"); rj.moveNext(); } //chkDuplicate: strFldName = "HandHeldID Number,Barcodes Text(50),Description Text(50),Quantity Currency"; modRecordSet.cnnDB.Execute("CREATE TABLE " + "Handheld777" + " (" + strFldName + ")"); System.Windows.Forms.Application.DoEvents(); rj = modRecordSet.getRS(ref "SELECT * FROM " + st_Name); while (rj.EOF == false) { rs = modRecordSet.getRS(ref "SELECT * FROM Handheld777 WHERE HandHeldID=" + rj.Fields("HandHeldID").Value + ";"); if (rs.RecordCount > 0) { strIn = "UPDATE Handheld777 SET Quantity = " + (rs.Fields("Quantity").Value + rj.Fields("Quantity").Value) + " WHERE HandHeldID=" + rj.Fields("HandHeldID").Value + ";"; } else { strIn = "INSERT INTO Handheld777 (HandHeldID,Barcodes,Quantity) VALUES (" + rj.Fields("HandHeldID").Value + ", '" + rj.Fields("Barcodes").Value + "', " + rj.Fields("Quantity").Value + ")"; } modRecordSet.cnnDB.Execute(strIn); rj.moveNext(); } modRecordSet.cnnDB.Execute("DELETE * FROM " + st_Name + ";"); //strIn = "SELECT Handheld777.* INTO " & st_Name & " FROM Handheld777" '& ResolveTable(cmbTables.Text) modRecordSet.cnnDB.Execute("INSERT INTO " + st_Name + " SELECT * FROM Handheld777;"); modRecordSet.cnnDB.Execute("DROP TABLE Handheld777;"); //chkDuplicate: //DeleteBlankID //MsgBox "File was extracted and exported succesfully", vbApplicationModal + vbInformation + vbOKOnly, App.title //prgUpdate.value = 300 }
public object TheSelect() { ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rst = default(ADODB.Recordset); rs = new ADODB.Recordset(); rst = new ADODB.Recordset(); modApplication.MyLIDWHole = Convert.ToInt16(DataList1.CurrentCell.Value); rs = modRecordSet.getRS(ref "SELECT BClabel.*, BClabelItem.* FROM BClabel INNER JOIN BClabelItem ON BClabel.BClabel_LabelID = BClabelItem.BClabelItem_LabelID WHERE BClabelItem.BClabelItem_LabelID=" + modApplication.MyLIDWHole + ""); modApplication.RecSel = rs.Fields("BClabelID").Value; modApplication.TheSelectedPrinterNew = 2; My.MyProject.Forms.frmBarcodeLoad.ShowDialog(); }
private void doSearch() { string sql = null; string lString = null; System.Windows.Forms.ListViewItem listItem = null; lString = Strings.Trim(txtSearch.Text); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); lString = Strings.Replace(lString, " ", " "); if (string.IsNullOrEmpty(lString)) { } else { lString = " AND (StockItem.StockItem_Name LIKE '%" + Strings.Replace(lString, " ", "%' AND StockItem.StockItem_Name LIKE '%") + "%')"; } lString = " WHERE StockBreak.StockBreak_Disabled=0 AND WarehouseStockItemLnk.WarehouseStockItemLnk_WarehouseID=2 AND WarehouseStockItemLnk_1.WarehouseStockItemLnk_WarehouseID=2 " + lString; gRS = modRecordSet.getRS(ref "SELECT StockBreak.StockBreak_Quantity, StockBreak.StockBreak_ParentID, StockItem.StockItem_Name, WarehouseStockItemLnk.WarehouseStockItemLnk_Quantity, StockBreak.StockBreak_ChildID, StockItemChild.StockItem_Name AS StockItemChild_Name, WarehouseStockItemLnk_1.WarehouseStockItemLnk_Quantity AS WarehouseStockItemLnkChild_Quantity FROM WarehouseStockItemLnk AS WarehouseStockItemLnk_1 INNER JOIN (WarehouseStockItemLnk INNER JOIN ((StockBreak INNER JOIN StockItem ON StockBreak.StockBreak_ParentID = StockItem.StockItemID) INNER JOIN StockItem AS StockItemChild ON StockBreak.StockBreak_ChildID = StockItemChild.StockItemID) ON WarehouseStockItemLnk.WarehouseStockItemLnk_StockItemID = StockItem.StockItemID) ON WarehouseStockItemLnk_1.WarehouseStockItemLnk_StockItemID = StockItemChild.StockItemID " + lString + " ORDER BY StockItem.StockItem_Name"); lvStock.Items.Clear(); while (!(gRS.EOF)) { listItem = lvStock.Items.Add(gRS.Fields("StockBreak_ParentID").Value + "_" + gRS.Fields("StockBreak_ChildID").Value, gRS.Fields("StockItem_Name").Value, ""); if (listItem.SubItems.Count > 0) { listItem.SubItems[0].Text = gRS.Fields("WarehouseStockItemLnk_Quantity").Value; } else { listItem.SubItems.Insert(0, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, gRS.Fields("WarehouseStockItemLnk_Quantity").Value)); } if (listItem.SubItems.Count > 1) { listItem.SubItems[1].Text = gRS.Fields("StockItemChild_Name").Value; } else { listItem.SubItems.Insert(1, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, gRS.Fields("StockItemChild_Name").Value)); } if (listItem.SubItems.Count > 2) { listItem.SubItems[2].Text = gRS.Fields("WarehouseStockItemLnkChild_Quantity").Value; } else { listItem.SubItems.Insert(2, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, gRS.Fields("WarehouseStockItemLnkChild_Quantity").Value)); } if (listItem.SubItems.Count > 3) { listItem.SubItems[3].Text = gRS.Fields("StockBreak_Quantity").Value; } else { listItem.SubItems.Insert(3, new System.Windows.Forms.ListViewItem.ListViewSubItem(null, gRS.Fields("StockBreak_Quantity").Value)); } gRS.moveNext(); } if (lvStock.FocusedItem == null) { this.lblData.Text = ""; picMove.Visible = false; } else { //UPGRADE_ISSUE: MSComctlLib.ListView event lvStock.ItemClick was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="ABD9AF39-7E24-4AFF-AD8D-3675C1AA3054"' lvStock_ItemClick(lvStock.FocusedItem); picMove.Visible = true; } }
private void printTransactionA4(ref transaction lTransaction) { string typeQuote = null; string typeAccountPayment = null; string typeConsignment = null; string typeConsignmentReturn = null; string typeAccountSaleCOD = null; string typeAccountSale = null; int lRetVal = 0; int hkey = 0; string vValue = null; decimal lnVat = default(decimal); string gPath = null; ADODB.Recordset rs = default(ADODB.Recordset); customer customer_Renamed = null; string sql = null; ADODB.Recordset rsNew = new ADODB.Recordset(); //Dim rsNew2 As New Recordset lineItem lineitem_Renamed = null; string lString = null; CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); short lPaymentType = 0; string[] lArray = null; decimal TCurrency = default(decimal); decimal QuoteTotal = default(decimal); // ERROR: Not supported in C#: OnErrorStatement //Set which invoice is required string sPrintGST = null; sPrintGST = ""; QuoteTotal = 0; //lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\4POS\pos", 0, KEY_QUERY_VALUE, hkey) //lRetVal = QueryValueEx(hkey, "printGST", sPrintGST) //RegCloseKey (hkey) //If sPrintGST = "" Then sPrintGST = "0" // If gParameters.A4Exclusive = True Then // Set Report = New cryReceipt1 // ElseIf sPrintGST = "1" Then // Set Report = New cryReceipt1 // Else Report.Load("cryReceipt.rpt"); // End If //lPaymentType = getPaymentType(lTransaction) //If lPaymentType And typeAccountPayment Then // printTransactionPaymentA4 lTransaction // Exit Sub //End If //Dim lnVat As Currency gPath = "C:\\4POS\\pos\\"; int lVatAmount = 0; int lAmount = 0; rsNew.Open(gPath + "data\\item.rs", , ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic); //, adOpenStatic, adLockOptimistic lnVat = 0; //a = rsNew.RecordCount //rsNew.Close //rsNew2.source = rsNew.source //rsNew("transactionItem_quantity").Type = rsNew("transactionItem_price").Type //rsNew("transactionItem_quantity").DefinedSize = rsNew("transactionItem_price").DefinedSize //rsNew2("transactionItem_quantity").Attributes = rsNew("transactionItem_price").Attributes //rsNew2("transactionItem_quantity").NumericScale = rsNew("transactionItem_price").NumericScale //rsNew2("transactionItem_quantity").Precision = rsNew("transactionItem_price").Precision foreach (lineItem lineitem_Renamed_loopVariable in lTransaction.lineItems) { lineitem_Renamed = lineitem_Renamed_loopVariable; rsNew.AddNew(); if (lineitem_Renamed.revoke) { } else { rsNew.Fields("transactionItem_build").Value = lineitem_Renamed.build; rsNew.Fields("transactionItem_code").Value = lineitem_Renamed.code; rsNew.Fields("transactionItem_depositType").Value = lineitem_Renamed.depositType; rsNew.Fields("transactionItem_id").Value = lineitem_Renamed.id; rsNew.Fields("transactionItem_lineNo").Value = lineitem_Renamed.lineNo; rsNew.Fields("transactionItem_name").Value = lineitem_Renamed.name; rsNew.Fields("transactionItem_originalPrice").Value = lineitem_Renamed.originalPrice; rsNew.Fields("transactionItem_price").Value = lineitem_Renamed.price; rsNew.Fields("transactionItem_quantity").Value = lineitem_Renamed.quantity; rsNew.Fields("transactionItem_receiptName").Value = Strings.LTrim(Strings.Mid(lineitem_Renamed.receiptName, Strings.InStr(1, lineitem_Renamed.receiptName, "x") + 1, Strings.Len(lineitem_Renamed.receiptName))); //lineitem.receiptName rsNew.Fields("transactionItem_reversal").Value = lineitem_Renamed.reversal; rsNew.Fields("transactionItem_revoke").Value = lineitem_Renamed.revoke; rsNew.Fields("transactionItem_set").Value = lineitem_Renamed.setBuild; rsNew.Fields("transactionItem_shrink").Value = lineitem_Renamed.shrink; rsNew.Fields("transactionItem_type").Value = lineitem_Renamed.transactionType; rsNew.Fields("transactionItem_vat").Value = lineitem_Renamed.vat; if (lineitem_Renamed.vat > 0) lnVat = lnVat + ((lineitem_Renamed.quantity * lineitem_Renamed.price) - ((lineitem_Renamed.quantity * lineitem_Renamed.price) / (1 + (lineitem_Renamed.vat / 100)))); QuoteTotal = QuoteTotal + (lineitem_Renamed.quantity * lineitem_Renamed.price); //If gParameters.A4Exclusive = True Then TCurrency = TCurrency + ((lineitem.quantity * lineitem.price) / (1 + (lineitem.vat) / 100)) //TCurrency = 0 'TCurrency + ((lineitem.quantity * lineitem.price) / (1 + (lineitem.vat) / 100)) rsNew.update(); } } //rsNew.MoveFirst //vValue = rsNew("transactionItem_quantity") vValue = ""; lRetVal = modUtilities.RegOpenKeyEx(modUtilities.HKEY_LOCAL_MACHINE, "Software\\4POS\\pos", 0, modUtilities.KEY_QUERY_VALUE, ref hkey); lRetVal = modUtilities.QueryValueEx(hkey, "A4Items", ref vValue); modUtilities.RegCloseKey(hkey); if (string.IsNullOrEmpty(vValue)) vValue = "0"; if (vValue == "1") { rsNew.Sort = "transactionItem_receiptName"; } else if (vValue == "0") { } Report.Database.Tables(1).SetDataSource(rsNew); //Report.Database.Tables(2).SetDataSource rsNew, 3 Report.SetParameterValue("txtCompanyName", lTransaction.companyName); Report.SetParameterValue("txtCompanyDetails1", lTransaction.heading1); if (!string.IsNullOrEmpty(lTransaction.heading2)) { Report.SetParameterValue("txtCompanyDetails2", lTransaction.heading2); if (!string.IsNullOrEmpty(lTransaction.heading3)) { Report.SetParameterValue("txtCompanyDetails3", lTransaction.heading3); //If gParameters.tr_PrintInvoice = False Then if (!string.IsNullOrEmpty(lTransaction.taxNumber)) { Report.SetParameterValue("txtCompanyDetails4", "TAX NO :" + lTransaction.taxNumber); } //End If } else { //If gParameters.tr_PrintInvoice = False Then if (!string.IsNullOrEmpty(lTransaction.taxNumber)) { Report.SetParameterValue("txtCompanyDetails3", "TAX NO :" + lTransaction.taxNumber); } //End If } } else { if (!string.IsNullOrEmpty(lTransaction.heading3)) { Report.SetParameterValue("txtCompanyDetails2", lTransaction.heading3); //If gParameters.tr_PrintInvoice = False Then if (!string.IsNullOrEmpty(lTransaction.taxNumber)) { Report.SetParameterValue("txtCompanyDetails3", "TAX NO :" + lTransaction.taxNumber); } //End If } else { //If gParameters.tr_PrintInvoice = False Then if (!string.IsNullOrEmpty(lTransaction.taxNumber)) { Report.SetParameterValue("txtCompanyDetails2", "TAX NO :" + lTransaction.taxNumber); } //End If } } lString = lString + lTransaction.heading1 + Strings.Chr(13); lString = lString + lTransaction.heading2 + Strings.Chr(13); lString = lString + lTransaction.heading3 + Strings.Chr(13); if (!string.IsNullOrEmpty(lTransaction.taxNumber)) lString = lString + "TAX NO :" + lTransaction.taxNumber; lString = Strings.Replace(lString, Strings.Chr(13) + Strings.Chr(13), Strings.Chr(13)); lString = Strings.Replace(lString, Strings.Chr(13) + Strings.Chr(13), Strings.Chr(13)); Report.SetParameterValue("txtInvoiceNumber", lTransaction.transactionID); Report.SetParameterValue("txtInvoiceDate", Strings.Format(lTransaction.transactionDate, "dd mmm yyyy hh:mm")); Report.SetParameterValue("txtPOS", lTransaction.posName); Report.SetParameterValue("txtCashier", lTransaction.cashierName); if (Strings.LCase(lTransaction.transactionType) == "deposit credit") { Report.SetParameterValue("txtType", "DEPOSIT CREDIT"); Report.SetParameterValue("txtTypeSpecial", ""); Report.SetParameterValue("txtInvoiceNumber", "[" + lTransaction.transactionID + "]"); } else { if (lTransaction.transactionSpecial_Renamed == null) { if (lTransaction.customer_Renamed == null) { Report.SetParameterValue("txtCustomer", "Cash Sale"); switch (lTransaction.paymentType) { case Convert.ToString(1): Report.SetParameterValue("txtCustomer", "Cash Sale"); break; case Convert.ToString(2): Report.SetParameterValue("txtCustomer", "Credit Card Sale"); break; case Convert.ToString(3): Report.SetParameterValue("txtCustomer", "Debit Card Sale"); break; case Convert.ToString(4): Report.SetParameterValue("txtCustomer", "Cheque Sale"); break; case Convert.ToString(7): Report.SetParameterValue("txtCustomer", "Split Tender"); break; default: Report.SetParameterValue("txtCustomer", "Cash Sale"); break; } Report.SetParameterValue("txtType", "TAX INVOICE"); Report.SetParameterValue("txtTypeSpecial", ""); } else { Report.SetParameterValue("txtSigned", lTransaction.customer_Renamed.signed_Renamed); Report.SetParameterValue("txtCustomer", lTransaction.customer_Renamed.name); if (!string.IsNullOrEmpty(lTransaction.customer_Renamed.physical)) { lArray = Strings.Split(lTransaction.customer_Renamed.physical, Constants.vbCrLf); Report.SetParameterValue("txtCustAddress1", lArray[0]); if (Information.UBound(lArray) >= 1) Report.SetParameterValue("txtCustAddress2", lArray[1]); if (Information.UBound(lArray) >= 2) Report.SetParameterValue("txtCustAddress3", lArray[2]); if (Information.UBound(lArray) >= 3) Report.SetParameterValue("txtCustAddress4", lArray[3]); } if (!string.IsNullOrEmpty(lTransaction.customer_Renamed.tax)) Report.SetParameterValue("txtCustAddress5", "TAX NO: " + lTransaction.customer_Renamed.tax); //Report.txtCustomerAddress.SetText lTransaction.customer.name & Chr(13) & Chr(13) & Replace(lTransaction.customer.physical, Chr(10), "") & Chr(13) & Chr(13) & "TAX NO: " & lTransaction.customer.tax Report.SetParameterValue("txtType", "TAX INVOICE"); if (lTransaction.customer_Renamed.terms) { Report.SetParameterValue("txtTypeSpecial", "Account Sale"); } else { Report.SetParameterValue("txtTypeSpecial", "Cash Sale"); } } } else { Report.SetParameterValue("txtType", ""); Report.SetParameterValue("txtTypeSpecial", ""); if (lPaymentType & typeQuote) { Report.SetParameterValue("txtType", "QUOTE"); if (lPaymentType & typeConsignment) { if (lPaymentType & typeAccountSale | lPaymentType & typeAccountSaleCOD) { Report.SetParameterValue("txtTypeSpecial", "Account Consignment"); } else { Report.SetParameterValue("txtTypeSpecial", "Consignment"); } } else if (lPaymentType & typeConsignmentReturn) { if (lPaymentType & typeAccountSale | lPaymentType & typeAccountSaleCOD) { Report.SetParameterValue("txtTypeSpecial", "Account Consignment Return Quote"); } else { Report.SetParameterValue("txtTypeSpecial", "Consignment Return"); } } else { if (lPaymentType & typeAccountSale | lPaymentType & typeAccountSaleCOD) { Report.SetParameterValue("txtTypeSpecial", "Account"); } else { Report.SetParameterValue("txtTypeSpecial", ""); } } } else if (lPaymentType & typeConsignment) { if (lPaymentType & typeAccountSale | lPaymentType & typeAccountSaleCOD) { Report.SetParameterValue("txtType", "Account Consignment Sale"); } else { Report.SetParameterValue("txtType", "Consignment Sale"); } } else if (lPaymentType & typeConsignmentReturn) { if (lPaymentType & typeAccountSale | lPaymentType & typeAccountSaleCOD) { Report.SetParameterValue("txtType", "Account Consignment Return"); } else { Report.SetParameterValue("txtType", "Consignment Return"); } } else if (lPaymentType & typeAccountSale) { Report.SetParameterValue("txtType", "Account Sale"); } else if (lPaymentType & typeAccountPayment) { Report.SetParameterValue("txtType", "Account Payment"); } if (lTransaction.customer_Renamed == null) { if (!string.IsNullOrEmpty(lTransaction.transactionSpecial_Renamed.address)) { lArray = Strings.Split(lTransaction.transactionSpecial_Renamed.address, Constants.vbCrLf); Report.SetParameterValue("txtCustAddress1", lArray[0]); if (Information.UBound(lArray) >= 1) Report.SetParameterValue("txtCustAddress2", lArray[1]); if (Information.UBound(lArray) >= 2) Report.SetParameterValue("txtCustAddress3", lArray[2]); if (Information.UBound(lArray) >= 3) Report.SetParameterValue("txtCustAddress4", lArray[3]); } Report.SetParameterValue("txtSigned", lTransaction.transactionSpecial_Renamed.name); Report.SetParameterValue("txtCustomer", lTransaction.transactionSpecial_Renamed.name); } else { if (!string.IsNullOrEmpty(lTransaction.customer_Renamed.tax)) lTransaction.customer_Renamed.physical = lTransaction.customer_Renamed.physical; if (!string.IsNullOrEmpty(lTransaction.customer_Renamed.physical)) { lArray = Strings.Split(lTransaction.customer_Renamed.physical, Constants.vbCrLf); Report.SetParameterValue("txtCustAddress1", lArray[0]); if (Information.UBound(lArray) >= 1) Report.SetParameterValue("txtCustAddress2", lArray[1]); if (Information.UBound(lArray) >= 2) Report.SetParameterValue("txtCustAddress3", lArray[2]); if (Information.UBound(lArray) >= 3) Report.SetParameterValue("txtCustAddress4", lArray[3]); } Report.SetParameterValue("txtSigned.", lTransaction.customer_Renamed.signed_Renamed); Report.SetParameterValue("txtCustomer", lTransaction.customer_Renamed.name); } } } //do report reference..... if (!string.IsNullOrEmpty(lTransaction.CardRefer)) { Report.SetParameterValue("txtCard", "Card Reference : " + lTransaction.CardRefer); //ElseIf gParameters.CardRefer = True Then // Report.txtCard.SetText "Card Reference : " & stCard } if (!string.IsNullOrEmpty(lTransaction.OrderRefer)) { Report.SetParameterValue("txtOrder", "Order Reference : " + lTransaction.OrderRefer); //ElseIf gParameters.OrderRefer = True Then // Report.txtOrder.SetText "Order Reference : " & stOrder } if (!string.IsNullOrEmpty(lTransaction.SerialRefer)) { Report.SetParameterValue("txtSerial", "Serial Reference : " + lTransaction.SerialRefer); //ElseIf gParameters.SerialRefer = True Then // Report.txtSerial.SetText "Serial Reference : " & stSerial } Report.SetParameterValue("txtDiscount", Strings.FormatNumber(lTransaction.paymentDiscount, 2)); //If gParameters.A4Exclusive = True Then // Report.txtAText.SetText FormatNumber(TCurrency - lTransaction.paymentDiscount, 2) //End If //If frmMain.lblChange.Caption = "" Then frmMain.lblChange.Caption = "0.00" if (lPaymentType & typeQuote) { Report.SetParameterValue("txtTender", Strings.FormatNumber("0.00", 2)); } else { Report.SetParameterValue("txtTender", Strings.FormatNumber(lTransaction.paymentTender, 2)); // lTransaction.paymentTender, 2) } Report.SetParameterValue("txtVAT", Strings.FormatNumber(lnVat, 2)); Report.SetParameterValue("txtChange", Strings.FormatNumber("0.00", 2)); //Report.txtTotal.SetText FormatNumber(lTransaction.paymentTotal, 2) if (lPaymentType & typeQuote) { //FIXED: it was calculating twice Report.txtTotal.SetText FormatNumber((QuoteTotal - lTransaction.paymentDiscount), 2) Report.SetParameterValue("txtTotal", Strings.FormatNumber(QuoteTotal, 2)); //a = QuoteTotal } else { Report.SetParameterValue("txtTotal", Strings.FormatNumber(lTransaction.paymentTotal, 2)); } if (lPaymentType & typeQuote | lPaymentType & typeConsignment | lPaymentType & typeConsignmentReturn | lPaymentType & typeAccountSale) { Report.ReportDefinition.Sections("Section7").SectionFormat.EnableSuppress = true; } //New banking details ADODB.Recordset rsCompBank = default(ADODB.Recordset); rsCompBank = modRecordSet.getRS(ref "select * from Company;"); if (rsCompBank.RecordCount) { if (Information.IsDBNull(rsCompBank.Fields("Company_BankName").Value)) { } else { Report.SetParameterValue("txtBankName", rsCompBank.Fields("Company_BankName")); } if (Information.IsDBNull(rsCompBank.Fields("Company_BranchName").Value)) { } else { Report.SetParameterValue("txtBranchName", rsCompBank.Fields("Company_BranchName")); } if (Information.IsDBNull(rsCompBank.Fields("Company_BranchCode").Value)) { } else { Report.SetParameterValue("txtBranchCode", rsCompBank.Fields("Company_BranchCode")); } if (Information.IsDBNull(rsCompBank.Fields("Company_AccountNumber").Value)) { } else { Report.SetParameterValue("txtAccountNumber", rsCompBank.Fields("Company_AccountNumber")); } } //................... //Report.selectPrinter "", Printer.DeviceName, "" //'Report.VerifyOnEveryPrint = True //Report.PrintOut False System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); My.MyProject.Forms.frmReportShow.ShowDialog(); return; ptA4: Interaction.MsgBox(Err().Number + Err().Description); // ERROR: Not supported in C#: ResumeStatement }
private void loadData() { string sql = null; ADODB.Connection cn = default(ADODB.Connection); ADODB.Recordset rs = new ADODB.Recordset(); short x = 0; string tmp = null; //If openConnection() Then // frmMain.lblPath.Caption = serverPath // closeConnection //End If cn = modRecordSet.openConnectionInstance(); if (cn == null) { this.Close(); return; } else { sql = "SELECT Company.Company_MonthEndID FROM Company;"; rs.Open(sql, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); gMonthEnd = rs.Fields("Company_MonthEndID").Value; cmbMonth.Items.Add(new LBI("This Month", gMonthEnd)); for (x = 2; x <= gMonthEnd; x++) { tmp = (x - 1).ToString() + " Months Ago"; cmbMonth.Items.Add(new LBI(tmp, gMonthEnd - x + 1)); } cmbMonth.SelectedIndex = 0; cmbPOS.Items.Add(new LBI("[All Point Of Sale]", 0)); for (x = 1; x <= 12; x++) { tmp = "Point of Sale " + x.ToString(); cmbPOS.Items.Add(new LBI(tmp, x)); } cmbPOS.SelectedIndex = 0; } cmdsearch_Click_Payment(); cmdsearch_Click(cmdSearch, new System.EventArgs()); cmdsearch_Click_Alloc(); cmdAllocate.Focus(); }
private void loadCompanies() { string locationCompany_Name = null; int locationCompanyID = 0; int x = 0; ADODB.Recordset rs = new ADODB.Recordset(); System.Windows.Forms.ListViewItem lListitem = null; rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient; if (openConnection()) { } rs.Open("SELECT locationCompany.locationCompanyID, location.location_Name, locationCompany.locationCompany_Name, locationCompany.locationCompany_Path FROM location INNER JOIN locationCompany ON location.locationID = locationCompany.locationCompany_LocationID ORDER BY location.location_Name, locationCompany.locationCompany_Name;", cnnDBmaster, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic); //Me.lvLocation.ListItems.Clear if (rs.RecordCount) { x = -1; object[,] gArray = new object[rs.RecordCount, 3]; while (!(rs.EOF)) { x = x + 1; gArray[x, 0] = rs.Fields(locationCompanyID).Value; gArray[x, 1] = rs.Fields(locationCompany_Name).Value + ""; gArray[x, 2] = 0; rs.moveNext(); } rs.Close(); //Do Until rs.EOF // Set lListitem = lvLocation.ListItems.Add(, "k" & rs("locationCompanyID"), rs("locationCompany_Name"), , 2) // lListitem.SubItems(1) = rs("location_Name") & "" // lListitem.SubItems(2) = rs("locationCompany_Path") & "" // If LCase(rs("locationCompany_Path") & "") = LCase(serverPath & "pricing.mdb") Then // lListitem.Selected = True // 'lvLocation_DblClick // End If // rs.moveNext //Loop } }
private void report_WHTransfer(ref string tblName) { ADODB.Recordset rs = default(ADODB.Recordset); string sql = null; CrystalDecisions.CrystalReports.Engine.ReportDocument Report = default(CrystalDecisions.CrystalReports.Engine.ReportDocument); Report.Load("cryWHRecVerify.rpt"); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; rs = modRecordSet.getRS(ref "SELECT Company.Company_Name FROM Company;"); Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name")); rs.Close(); sql = "SELECT Handheld777_0.HandHeldID, StockItem.StockItem_Name, Handheld777_0.Quantity"; sql = sql + " FROM Handheld777_0 INNER JOIN StockItem ON Handheld777_0.HandHeldID = StockItem.StockItemID;"; rs = modRecordSet.getRS(ref sql); CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = default(CrystalDecisions.CrystalReports.Engine.ReportDocument); ReportNone.Load("cryNoRecords.rpt"); if (rs.BOF | rs.EOF) { ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString); ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString); My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone; My.MyProject.Forms.frmReportShow.mReport = ReportNone; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); return; } Report.Database.Tables(1).SetDataSource(rs); //Report.VerifyOnEveryPrint = True My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString; My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); }