public void armaFacturaCaEconn(ExcelWorksheet hojaXl, int fila, string sTimeStamp, IParametrosXL param) { try { String sopnumbe = hojaXl.Cells[fila, param.FacturaSopnumbe].Value.ToString().Trim(); String serie = sopnumbe.Substring(0, 1); facturaSopCa.BACHNUMB = sTimeStamp; facturaSopCa.SOPTYPE = 3; facturaSopCa.DOCID = "SERIE " + serie; facturaSopCa.SOPNUMBE = sopnumbe; facturaSopCa.DOCDATE = DateTime.Parse(hojaXl.Cells[fila, param.FacturaSopDocdate].Value.ToString().Trim()).ToString(param.FormatoFechaXL); facturaSopCa.DUEDATE = DateTime.Parse(hojaXl.Cells[fila, param.FacturaSopDuedate].Value.ToString().Trim()).ToString(param.FormatoFechaXL); String custnmbr = hojaXl.Cells[fila, param.FacturaSopTXRGNNUM].Value == null ? "_enblanco" : hojaXl.Cells[fila, param.FacturaSopTXRGNNUM].Value.ToString().Trim(); facturaSopCa.CUSTNMBR = getCustomer(custnmbr); facturaSopCa.CREATETAXES = 1; //1:crear impuestos automáticamente facturaSopCa.DEFPRICING = 0; //0:se debe indicar el precio unitario facturaSopCa.REFRENCE = "Carga automática"; facturaSopDe.SOPTYPE = facturaSopCa.SOPTYPE; facturaSopDe.SOPNUMBE = facturaSopCa.SOPNUMBE; facturaSopDe.CUSTNMBR = facturaSopCa.CUSTNMBR; facturaSopDe.DOCDATE = facturaSopCa.DOCDATE; facturaSopDe.ITEMNMBR = facturaSopCa.DOCID; facturaSopDe.QUANTITY = 1; facturaSopDe.DEFEXTPRICE = 1; //1: calcular el precio extendido en base al precio unitario y la cantidad Decimal unitprice = 0; if (Decimal.TryParse(hojaXl.Cells[fila, param.FacturaSopUNITPRCE].Value.ToString(), out unitprice)) { facturaSopCa.SUBTOTAL = Decimal.Round(unitprice, 2); facturaSopCa.DOCAMNT = facturaSopCa.SUBTOTAL; facturaSopDe.UNITPRCE = Decimal.Round(unitprice, 2); } else { throw new FormatException("El monto es incorrecto en la fila " + fila.ToString() + ", columna " + param.FacturaSopUNITPRCE + " [armaFacturaCaEconn]"); } } catch (FormatException fmt) { throw new FormatException("Formato incorrecto en la fila " + fila.ToString() + " [armaFacturaCaEconn]", fmt); } catch (OverflowException ovr) { throw new OverflowException("Monto demasiado grande en la fila " + fila.ToString() + " [armaFacturaCaEconn]", ovr); } catch (NullReferenceException) { throw; } catch (InvalidOperationException) { throw; } //finally //{ // trace.Flush(); // trace.Close(); //} }
//public delegate void LogHandler(int iAvance, string sMsj); //public event LogHandler Progreso; //public event LogHandler Actualiza; /// <summary> /// Dispara el evento para actualizar la barra de progreso /// </summary> /// <param name="iProgreso"></param> //public void OnProgreso(int iAvance, string sMsj) //{ // if (Progreso != null) // Progreso(iAvance, sMsj); //} //public void OnActualiza(int i, string carpeta) //{ // if (Actualiza != null) // Actualiza(i, carpeta); //} public IntegraVentasBandejaXL(IParametrosXL paramIntegraGP) { _iError = 0; _ParamExcel = paramIntegraGP; }
public void preparaFacturaSOP(ExcelWorksheet hojaXl, int filaXl, string sTimeStamp, IParametrosXL param) { //try //{ //_iniciaNuevaFacturaEn = filaXl + 1; armaFacturaCaEconn(hojaXl, filaXl, sTimeStamp, param); facturaSop.taSopHdrIvcInsert = facturaSopCa; facturaSop.taSopLineIvcInsert_Items = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[] { facturaSopDe }; //} //catch (eConnectException) //{ // throw; //} //catch (NullReferenceException) //{ // throw; //} //catch (InvalidOperationException) //{ // throw; //} //catch (Exception) //{ // throw; //} }