Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Constants.au3>
- #include <FTPEx.au3>
- #include <Array.au3>
- #include <WinAPIShPath.au3>
- #include <Date.au3>
- #include <MsgBoxConstants.au3>
- #include <FileConstants.au3>
- #include <SQLite.au3>
- #include <SQLite.dll.au3>
- #include <File.au3>
- #include <Excel.au3>
- _SQLite_Startup("sqlite3.dll")
- If @error Then
- MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!")
- Exit -1
- EndIf
- _SQLite_Open()
- If @error Then
- MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")
- Exit -1
- EndIf
- ;RUTAS PARA ARCHIVOS DE PRIMER CRUCE
- local $ls_rutaMesa ="\\Gppesvlcli1376\AutoOp\Desarro\PacificA\"
- local $ls_nombreEmitidos="Emitidos (10.07 - 16.07).xlsx"
- Local $ls_nombreEmitidosaux="Emitidos (10.07 - 16.07).xlsx"
- Local $l_Excel1 = _Excel_Open()
- Local $l_WorkbookEmitidos = _Excel_BookOpen($l_Excel1, $ls_rutaMesa &"\"&$ls_nombreEmitidos)
- local $ls_nombreEmitidos1= StringReplace(StringUpper($ls_nombreEmitidos),".XLSX","")
- _Excel_BookSaveAs($l_WorkbookEmitidos, $ls_rutaMesa&"\"&$ls_nombreEmitidos1&"-"&1&".txt", $xlTextWindows , True)
- Global $ls_numlineasPaci=_FileCountLines ($ls_rutaMesa&$ls_nombreEmitidos1&"-"&1&".txt")
- _SQLite_Exec(-1, "CREATE TABLE Emiciones (a,b,c,d,e,f,g,h,i,j,k,l,m,n);")
- Local $hFileOpen = FileOpen($ls_rutaMesa&$ls_nombreEmitidos1&"-"&1&".txt", $FO_READ)
- Local $contador=0
- Local $contadoraux=1
- Local $hQuery, $aRow, $sMsg
- Local $l_Excel2 = _Excel_Open()
- Local $l_WorkbookEmitidos2 = _Excel_BookOpen($l_Excel2, $ls_rutaMesa &"\"&$ls_nombreEmitidosaux)
- _Excel_SheetAdd($l_WorkbookEmitidos2, -1, False, 3, "OK|HojaPrueba1|HojaPrueba2")
- Do
- $contador=$contador+1
- $linea2=FileReadLine($hFileOpen,$contador)
- $linea2=StringSplit($linea2, Chr (9))
- if StringStripWS($linea2[5],8)<>"MIFARMAS.A.C." and StringStripWS($linea2[5],8)<>"PERUANADEESTACIONESDESERVICIOSS.A.C." and StringStripWS($linea2[5],8)<>"PLAZAVEAORIENTES.A.C." and StringStripWS($linea2[5],8)<>"HIPERMERCADOSTOTTUSS.A" and $linea2[5]<>"SUPERMERCADOS PERUANOS S.A. " then
- _SQLite_Exec(-1, "INSERT INTO Emiciones(a,b,c,d,e,f,g,h,i,j,k,l,m,n) VALUES ('"&$linea2[1]&"','"&$linea2[2]&"','"&$linea2[3]&"','"&$linea2[4]&"','"&$linea2[5]&"','"&$linea2[6]&"','"&$linea2[7]&"','"&$linea2[8]&"','"&$linea2[9]&"','"&$linea2[10]&"','"&$linea2[11]&"','"&StringReplace(StringReplace($linea2[12],chr(34),""),",","")&"','"&StringReplace(StringReplace($linea2[13],chr(34),""),",","")&"','"&StringReplace(StringReplace($linea2[14],chr(34),""),",","")&"')","_cb")
- $contadoraux=$contadoraux+1
- endif
- Until $contador>=$ls_numlineasPaci
- $contadoraux=0
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- _SQLite_Query(-1, "SELECT * FROM Emiciones ;", $hQuery)
- While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
- $contadoraux=$contadoraux+1
- consolewrite($aRow[0]&"-"&$aRow[1]&"-"&$aRow[2]&"-"&$aRow[3]&"-"&$aRow[4]&"-"&$aRow[5]&"-"&$aRow[2]&"-"&$aRow[6]&"-"&$aRow[7]&"-"&$aRow[8]&"-"&$aRow[9]&"-"&$aRow[10]&"-"&$aRow[11]&"-"&$aRow[12]&"-"&$aRow[13]&@CRLF)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[1], "A"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[2], "B"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[3], "C"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[4], "D"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[5], "E"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[6], "F"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[7], "G"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[8], "H"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[9], "I"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[10], "J"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[11], "K"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[12], "L"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[13], "M"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",StringRight($aRow[1],5), "O"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "OK","CORRD", "O1")
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[1], "A"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[2], "B"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[3], "C"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[4], "D"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[5], "E"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[6], "F"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[7], "G"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[8], "H"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[9], "I"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[10], "J"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[11], "K"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[12], "L"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[13], "M"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",StringRight($aRow[1],5), "O"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1","CORRD", "O1")
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[1], "A"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[2], "B"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[3], "C"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[4], "D"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[5], "E"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[6], "F"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[7], "G"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[8], "H"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[9], "I"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[10], "J"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[11], "K"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[12], "L"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[13], "M"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",StringRight($aRow[1],5), "O"&$contadoraux)
- _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2","CORRD", "O1")
- WEnd
- _SQLite_QueryFinalize($hQuery)
- consolewrite("---------------SEGUNDA PARTE--------------------"&@CRLF)
- Local $hQuery1, $aRow1, $sMsg1
- Local $l_Excel3 = _Excel_Open()
- If @error Then
- MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 1", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
- Exit
- endif
- Local $l_WorkbookEmitidos3 = _Excel_BookNew ( $l_Excel3 , 1 )
- Local $ls_nombreExcel3="Maqueta "&StringMid($ls_nombreEmitidosaux,11,2)&" - "&StringMid($ls_nombreEmitidosaux,18,2)
- Local $ln_contador3=3
- _Excel_BookSaveAs($l_WorkbookEmitidos3, $ls_rutaMesa&"\"&$ls_nombreExcel3&").xls", $xlWorkbookDefault, True)
- _Excel_SheetAdd($l_WorkbookEmitidos3, -1, False, 5, "Resumen|TD|DATA RV| HT (RV)|MAQUETA FINAL")
- _Excel_SheetDelete($l_WorkbookEmitidos3, 1)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen","Resumen Registro de Ventas del "&StringMid($ls_nombreEmitidosaux,11,2)&" al"&StringMid($ls_nombreEmitidosaux,18,3)&"de "&StringMid($ls_nombreEmitidosaux,24,2)&" 2019", "A2")
- _SQLite_Query(-1, "SELECT d,e,SUM(n) FROM Emiciones group by e;", $hQuery1)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","RUC", "A3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Razon Social", "B3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL SOL", "C3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL 12%", "D3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","RUC", "A3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Razon Social", "B3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL SOL", "C3")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL 12%", "D3")
- Local $ln_suma=0
- Local $ln_suma_igv=0
- While _SQLite_FetchData($hQuery1, $aRow1) = $SQLITE_OK
- consolewrite($aRow1[0]&"-"&$aRow1[1]&"-"&$aRow1[2]&@CRLF)
- if StringStripWS($aRow1[0],8)<>"RUC" then
- $ln_contador3=$ln_contador3+1
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[0], "A"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[1], "B"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[2], "C"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",0.12*$aRow1[2], "D"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[0], "A"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[1], "B"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[2], "C"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",0.12*$aRow1[2], "D"&$ln_contador3)
- $ln_suma=$ln_suma+$aRow1[2]
- $ln_suma_igv=$ln_suma_igv+(0.12*$aRow1[2])
- endif
- WEnd
- $ln_contador3=$ln_contador3+1
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen","Total General", "A"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$ln_suma_igv, "D"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$ln_suma, "C"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Total General", "A"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$ln_suma_igv, "D"&$ln_contador3)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$ln_suma, "C"&$ln_contador3)
- consolewrite("---------------TERCERA PARTE--------------------"&@CRLF)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","FACTURA", "A1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Fecha Emisión", "B1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","RUC", "C1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Razón Social", "D1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","TOTAL SOL", "E1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","TOTAL 12%", "F1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","No. Factura", "H1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Razon social", "I1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Cuenta B Nación", "J1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Fecha documento", "K1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","RUC", "L1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Importe 12%", "M1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Moneda", "N1")
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","No. Factura", "A1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Razon social", "B1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Cuenta B Nación", "C1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Fecha documento", "D1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","RUC", "E1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Importe 12%", "F1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Moneda", "G1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "H1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "I1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "AB1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "AC1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "CI1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "CJ1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","C", "CT1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","C", "CU1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Canal", "EP1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Cta Anti", "EQ1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Texto", "ER1")
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","FECHA DE ENVIO", "Q1")
- Local $ln_contador4=1
- Local $hQuery2, $aRow2, $sMsg2
- _SQLite_Query(-1, "SELECT * FROM Emiciones ;", $hQuery2)
- While _SQLite_FetchData($hQuery2, $aRow2) = $SQLITE_OK
- If StringStripWS($aRow2[3],8)<>"RUC" then
- $ln_contador4=$ln_contador4+1
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[1], "A"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[2], "B"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[3], "C"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[4], "D"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[13], "E"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",0.12*$aRow2[13], "F"&$ln_contador4)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[1], "H"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[4], "I"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","5720970303", "J"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[2], "K"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[3], "L"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",0.12*$aRow2[13], "M"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","PEN", "N"&$ln_contador4)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[1], "A"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[4], "B"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","5720970303", "C"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",StringReplace($aRow2[2],"/",""), "D"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "E"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[13], "F"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","PEN", "G"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "H"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","1", "I"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","1", "J"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","FB01", "K"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","SA", "L"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","0055", "M"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","PEN", "N"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "O"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",StringReplace($aRow2[2],"/",""), "P"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","'0"&@MDAY&StringReplace(@MON,"0","")&@YEAR, "Q"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "R"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3]&" - AUTODETRACCION RECARGAS", "S"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "T"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "U"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION RECARGAS", "V"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "W"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","'02", "X"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "Y"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "Z"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AA"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "AB"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "AC"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "AD"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","40", "AE"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AF"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "AG"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "AH"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AI"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AJ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AK"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AL"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "AM"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION "&$aRow2[4]&" "&$aRow2[1]&" ", "AN"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AP"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AQ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AR"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","5720970303", "AS"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AT"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AU"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AV"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AX"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AY"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AZ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BA"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BB"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BC"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BD"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BE"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BF"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BG"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BH"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BI"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BJ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BK"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BL"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BM"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BN"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BP"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BQ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BR"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BS"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BT"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BU"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BV"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BX"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BY"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BZ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CA"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CB"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CC"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CD"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CE"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CF"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CG"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Asiento_1", "CH"&$ln_contador4)
- ;order 3
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "CI"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","3", "CJ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "CK"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","50", "CL"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CM"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "CN"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "CO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","D0", "CP"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CQ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CR"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CS"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "CT"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION "&$aRow2[4]&" "&$aRow2[1]&" ", "CU"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CV"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CX"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CY"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","4739990000", "CZ"&$ln_contador4)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DA"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DB"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DC"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DD"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DE"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DF"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DG"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DH"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DI"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DJ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DK"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DL"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DM"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DN"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DP"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DQ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DR"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DS"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DT"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DU"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DV"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DX"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DY"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DZ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EA"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EB"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EC"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "ED"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EE"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EF"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EG"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EH"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EI"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EJ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EK"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EL"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EM"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EN"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Asiento_1", "EO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Distribuidores", "EP"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "EQ"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "ER"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "ES"&$ln_contador4)
- endif
- WEnd
- $ln_contador4=$ln_contador4+1
- Local $ls_copia=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "H2:AA"&$ln_contador4)
- Local $ls_copia2=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "AB2:CH"&$ln_contador4)
- Local $ls_copia3=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "CI2:EO"&$ln_contador4)
- _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia,"A1")
- _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia2,"A"&($ln_contador4-1))
- _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia3,"A"&(($ln_contador4*2)-3))
- _Excel_RangeSort($l_WorkbookEmitidos3, "MAQUETA FINAL", "A1:BG"&(($ln_contador4*3)-4), "A:A",Default, Default, $xlNo,Default,Default,"B:B",Default)
- _Excel_RangeDelete($l_WorkbookEmitidos3.ActiveSheet, "A1:B"&(($ln_contador4*3)-4), $xlShiftUp)
- Local $l_Excel4 = _Excel_Open()
- If @error Then
- MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 1", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
- Exit
- endif
- Local $ls_mes=StringMid($ls_nombreEmitidosaux,13,2)
- If $ls_mes="01" then
- $ls_mes="enero"
- endif
- If $ls_mes="02" then
- $ls_mes="febrero"
- endif
- If $ls_mes="03" then
- $ls_mes="marzo"
- endif
- If $ls_mes="04" then
- $ls_mes="abril"
- endif
- If $ls_mes="05" then
- $ls_mes="mayo"
- endif
- If $ls_mes="06" then
- $ls_mes="junio"
- endif
- If $ls_mes="07" then
- $ls_mes="julio"
- endif
- If $ls_mes="08" then
- $ls_mes="agosto"
- endif
- If $ls_mes="09" then
- $ls_mes="setiembre"
- endif
- If $ls_mes="10" then
- $ls_mes="octubre"
- endif
- If $ls_mes="11" then
- $ls_mes="noviembre"
- endif
- If $ls_mes="12" then
- $ls_mes="diciembre"
- endif
- Local $ls_nombreExcel4=StringMid($ls_nombreEmitidosaux,11,2)&" - "&StringMid($ls_nombreEmitidosaux,18,2)&" "&$ls_mes& @YEAR&" Autodetraccion"
- Local $l_WorkbookEmitidos4 = _Excel_BookNew ( $l_Excel4 , 1 )
- Local $ls_copia4=_Excel_RangeRead($l_WorkbookEmitidos3, "MAQUETA FINAL", "C1:BG"&(($ln_contador4*3)-4))
- _Excel_RangeWrite($l_WorkbookEmitidos4,1,$ls_copia4,"A1")
- _Excel_BookSaveAs($l_WorkbookEmitidos4, $ls_rutaMesa&"\"&$ls_nombreExcel4&").xls", $xlWorkbookDefault, True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement