public static bool buildCrystalReportAlmacen(int strDocEntry,string oAlmacen,string oPrinterName, string oUserId)
{
bool Retorno = false;
string strDSN = "";
string strAccount = "";
string strDbName = "";
try
{
ReportDocument Zona_Despacho_V1 = new ReportDocument(); // se instancia el reporte
Zona_Despacho_V1.Load(Environment.CurrentDirectory + @"\Zona_Despacho_V1.rpt"); //ruta donde se toma el archivo .rpt
Zona_Despacho_V1.SetParameterValue("DocEntry", strDocEntry); // pasa los parametros
Zona_Despacho_V1.SetParameterValue("Almacen", oAlmacen);
strDSN = SBO_Eventos.Globals.strDSN; //server HANA
strAccount = SBO_Eventos.Globals.strAccount; //usuario
strDbName = SBO_Eventos.Globals.strDbName; //nombre de la base de datos
#region OBTENCION DEL PASWORD Y EL NUMERO DE COPIAS DEL REPORTE
SAPbobsCOM.Recordset oRs = (SAPbobsCOM.Recordset)SBO_Conexion.m_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
oRs.DoQuery(Consultas.ConsultaPwsNroCopias());
oPws = oRs.Fields.Item("U_NX_PWSCR").Value.ToString(); //PASWORD PARA ESTA VERSION
oNroCopias = Convert.ToInt32(oRs.Fields.Item("U_NX_NRPRINT").Value.ToString()); // NUMERO DE COPIAS PAR AESTA VERSION
#endregion OBTENCION DEL PASWORD Y EL NUMERO DE COPIAS DE IMPRESION DEL REPORTE
string strConnection = "DRIVER= {B1CRHPROXY32};UID=" + strAccount; //string de conexion contruido de las variables
strConnection += ";PWD=" + oPws + ";SERVERNODE=" + strDSN;
strConnection += ";DATABASE=" + strDbName + ";";
NameValuePairs2 logonProps2 = Zona_Despacho_V1.DataSourceConnections[0].LogonProperties;
logonProps2.Set("Provider", "B1CRHPROXY32");
logonProps2.Set("Server Type", "B1CRHPROXY32");
logonProps2.Set("Connection String", strConnection);
logonProps2.Set("Locale Identifier", "1033");
Zona_Despacho_V1.DataSourceConnections[0].SetLogonProperties(logonProps2);
Zona_Despacho_V1.DataSourceConnections[0].SetConnection(strDSN, strDbName, strAccount, oPws);
Zona_Despacho_V1.PrintOptions.PrinterName = oPrinterName; //nombre de la impresora a utilizar
Zona_Despacho_V1.PrintToPrinter(oNroCopias, false, 1, oNroCopias); //se genera y se imprime el reporte
Zona_Despacho_V1.Close(); //se cierra el reporte
Zona_Despacho_V1.Dispose(); // se libera el reporte
Program.SBO_Application.StatusBar.SetText("Se ha generado la impresion de picking por Zona de despacho", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
Retorno = true;
}
catch (Exception er)
{
Program.SBO_Application.StatusBar.SetText(AddOn_NXIDP.Properties.Resources.AddOn_Name + " Error: CrystalReports.cs > buildCrystalReportAlmacen(): "
+ er.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
#region MENSAJE A USUARIO BODEGA POR FALLA DE IMPRESION
EnviarMensajeBodega(oUserId, oAlmacen, null, er.Message,SBO_Eventos.Globals.oPedido.DocNum.ToString());
#endregion MENSAJE A USUARIO BODEGA POR FALLA DE IMPRESION
Retorno = false;
}
return Retorno;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |