} //Constructor public override bool Find(String ShortageID) { if (ShortageID == String.Empty) { return(false); } DataRow row = oMySql.GetDataRow("Select * From Shortage Where ShortageID='" + ShortageID + "'", "Shortage"); if (row == null) { ID = String.Empty; return(false); } ID = row["ShortageID"].ToString(); this.SchoolName = row["Name"].ToString(); this.TeacherName = row["TeacherName"].ToString(); this.Detail = row["Detail"] == DBNull.Value ? "" : Global.ByteToString((byte[])row["Detail"]); this.DayPhone = row["DayPhone"].ToString(); this.EvePhone = row["EvePhone"].ToString(); this.QVNOption = row["QVNOption"].ToString(); this.Address = row["Address"].ToString() + " " + row["Address_2"].ToString(); this.Address_2 = ""; this.Attention = row["Attention"].ToString(); this.City = row["City"].ToString(); this.State = row["State"].ToString(); this.ZipCode = row["ZipCode"].ToString(); this.eMail = row["eMail"].ToString(); this.ParentName = row["ParentName"].ToString(); this.StudentName = row["StudentName"].ToString(); this.CompanyID = row["CompanyID"].ToString(); this.CustomerID = row["CustomerID"].ToString(); this.Type = row["Type"].ToString(); this.OrderID = row["OrderID"].ToString() == "0" ? "" : row["OrderID"].ToString(); this.Date = row["Detail"] == DBNull.Value ? Global.DNull : (DateTime)row["Date"]; this.User = row["User"].ToString(); Items.Load(this); this.currentDetail = Items.Detail; return(true); }
public String GetNextNumber() { DataRow row = oMySql.GetDataRow("SELECT MAX(LPAD(CONV(PurchaseID,10,10)+1,10,'0')) as Next FROM Purchase Where CompanyID='" + CompanyID + "'", "tmp"); if (row == null) { return("1".PadLeft(10, '0')); } else { //byte[] byteBLOBData = (Byte[])(row["Next"]); //return System.Text.Encoding.UTF8.GetString(byteBLOBData); if (row["Next"] == DBNull.Value) { return("0000000001"); } else { return(Global.ByteToString((Byte[])row["Next"])); } } }
public void Print(Boolean LocalPrint) { DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select *,'Text' From Shortage Where ShortageID='{0}'", ID), "Shortage")); Product oProduct = new Product(this.CompanyID); String SchoolName = ""; foreach (DataRow row in ds.Tables["Shortage"].Rows) { row["Text"] = Global.ByteToString((Byte[])(row["Detail"])); row["Address"] = row["Address"].ToString() + row["Address_2"].ToString(); foreach (DataRow drow in Items.Detail.Rows) { oProduct.Find(drow["ProductID"].ToString()); row["Text"] += "\n" + oProduct.InvCode + " - " + drow["ProductID"].ToString() + " - " + drow["Description"].ToString() + " - " + drow["Quantity"].ToString(); } if (row["CustomerID"].ToString().Trim() != "") { if (oCustomer.Find(row["CustomerID"].ToString())) { SchoolName = oCustomer.Name; } } } frmViewReport oViewReport = new frmViewReport(); //ds.WriteXml("dataset72.xml", XmlWriteMode.WriteSchema); ShortageReport oRpt = new ShortageReport(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc."); oRpt.SetParameterValue("SchoolName", SchoolName); oRpt.SetParameterValue("User", Global.CurrentUser); oRpt.SetParameterValue("Dates", ""); oRpt.SetParameterValue("Chairperson", ""); oRpt.SetParameterValue("StudentName", ""); String sType = "Not specified"; switch (Type) { case "A": sType = "Add"; break; case "O": sType = "0verage"; break; case "X": sType = "Delete"; break; case "M": sType = "Miscellaneous"; break; case "R": sType = "Refund"; break; case "D": sType = "Damaged"; break; case "B": sType = "Missing"; break; case "I": sType = "Internet"; break; case "E": sType = "Missing Entire Order"; break; case "Y": sType = "Discrepancy"; break; } oRpt.SetParameterValue("Type", sType); oRpt.SetParameterValue("BarCode", (sType != "Add")? "*" + ID + "*":""); if (OrderID.Trim() != "") { if (oCustomer.ShipDate != Global.DNull || oCustomer.DeliveryDate != Global.DNull) { String ShipDate = oCustomer.ShipDate == Global.DNull ? " " : oCustomer.ShipDate.ToString("MM/dd/yyyy"); String DeliveryDate = oCustomer.DeliveryDate == Global.DNull ? " " : oCustomer.DeliveryDate.ToString("MM/dd/yyyy"); oRpt.SetParameterValue("Dates", "Ship Date: " + ShipDate + " " + "Delivery Date:" + DeliveryDate); } if (oCustomer.Chairperson.Trim() != "") { oRpt.SetParameterValue("Chairperson", "Chairperson:" + oCustomer.Chairperson); } oOrder = new Order(CompanyID); oOrder.Find(Convert.ToInt32(OrderID)); oRpt.SetParameterValue("StudentName", "Student: " + oOrder.Student); } if (Global.CurrentUser == "JOYCE" || Global.CurrentUser == "ALVARO" || LocalPrint || Type == "R") { oViewReport.cReport.ReportSource = oRpt; oViewReport.cReport.PrintReport(); //oViewReport.ShowDialog(); } else { oRpt.PrintOptions.PrinterName = "\\\\srv1\\Shortage"; oRpt.PrintToPrinter(1, false, 1, 100); } ds.Dispose(); oRpt.Dispose(); oViewReport.Dispose(); }