Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.14 KB | None | 0 0
  1. #include <Constants.au3>
  2. #include <FTPEx.au3>
  3. #include <Array.au3>
  4. #include <WinAPIShPath.au3>
  5. #include <Date.au3>
  6. #include <MsgBoxConstants.au3>
  7. #include <FileConstants.au3>
  8. #include <SQLite.au3>
  9. #include <SQLite.dll.au3>
  10. #include <File.au3>
  11. #include <Excel.au3>
  12. _SQLite_Startup("sqlite3.dll")
  13. If @error Then
  14. MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!")
  15. Exit -1
  16. EndIf
  17. _SQLite_Open()
  18. If @error Then
  19. MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")
  20. Exit -1
  21. EndIf
  22. ;RUTAS PARA ARCHIVOS DE PRIMER CRUCE
  23. local $ls_rutaMesa ="\\Gppesvlcli1376\AutoOp\Desarro\PacificA\"
  24. local $ls_nombreEmitidos="Emitidos (10.07 - 16.07).xlsx"
  25. Local $ls_nombreEmitidosaux="Emitidos (10.07 - 16.07).xlsx"
  26. Local $l_Excel1 = _Excel_Open()
  27. Local $l_WorkbookEmitidos = _Excel_BookOpen($l_Excel1, $ls_rutaMesa &"\"&$ls_nombreEmitidos)
  28. local $ls_nombreEmitidos1= StringReplace(StringUpper($ls_nombreEmitidos),".XLSX","")
  29. _Excel_BookSaveAs($l_WorkbookEmitidos, $ls_rutaMesa&"\"&$ls_nombreEmitidos1&"-"&1&".txt", $xlTextWindows , True)
  30. Global $ls_numlineasPaci=_FileCountLines ($ls_rutaMesa&$ls_nombreEmitidos1&"-"&1&".txt")
  31. _SQLite_Exec(-1, "CREATE TABLE Emiciones (a,b,c,d,e,f,g,h,i,j,k,l,m,n);")
  32. Local $hFileOpen = FileOpen($ls_rutaMesa&$ls_nombreEmitidos1&"-"&1&".txt", $FO_READ)
  33. Local $contador=0
  34. Local $contadoraux=1
  35. Local $hQuery, $aRow, $sMsg
  36. Local $l_Excel2 = _Excel_Open()
  37. Local $l_WorkbookEmitidos2 = _Excel_BookOpen($l_Excel2, $ls_rutaMesa &"\"&$ls_nombreEmitidosaux)
  38. _Excel_SheetAdd($l_WorkbookEmitidos2, -1, False, 3, "OK|HojaPrueba1|HojaPrueba2")
  39. Do
  40. $contador=$contador+1
  41. $linea2=FileReadLine($hFileOpen,$contador)
  42. $linea2=StringSplit($linea2, Chr (9))
  43. 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
  44. _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")
  45. $contadoraux=$contadoraux+1
  46. endif
  47. Until $contador>=$ls_numlineasPaci
  48. $contadoraux=0
  49. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  50. _SQLite_Query(-1, "SELECT * FROM Emiciones ;", $hQuery)
  51. While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
  52. $contadoraux=$contadoraux+1
  53. 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)
  54. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[1], "A"&$contadoraux)
  55. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[2], "B"&$contadoraux)
  56. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[3], "C"&$contadoraux)
  57. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[4], "D"&$contadoraux)
  58. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[5], "E"&$contadoraux)
  59. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[6], "F"&$contadoraux)
  60. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[7], "G"&$contadoraux)
  61. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[8], "H"&$contadoraux)
  62. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[9], "I"&$contadoraux)
  63. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[10], "J"&$contadoraux)
  64. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[11], "K"&$contadoraux)
  65. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[12], "L"&$contadoraux)
  66. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK",$aRow[13], "M"&$contadoraux)
  67. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",StringRight($aRow[1],5), "O"&$contadoraux)
  68. _Excel_RangeWrite($l_WorkbookEmitidos2, "OK","CORRD", "O1")
  69. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[1], "A"&$contadoraux)
  70. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[2], "B"&$contadoraux)
  71. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[3], "C"&$contadoraux)
  72. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[4], "D"&$contadoraux)
  73. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[5], "E"&$contadoraux)
  74. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[6], "F"&$contadoraux)
  75. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[7], "G"&$contadoraux)
  76. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[8], "H"&$contadoraux)
  77. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[9], "I"&$contadoraux)
  78. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[10], "J"&$contadoraux)
  79. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[11], "K"&$contadoraux)
  80. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[12], "L"&$contadoraux)
  81. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",$aRow[13], "M"&$contadoraux)
  82. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1",StringRight($aRow[1],5), "O"&$contadoraux)
  83. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba1","CORRD", "O1")
  84. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[1], "A"&$contadoraux)
  85. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[2], "B"&$contadoraux)
  86. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[3], "C"&$contadoraux)
  87. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[4], "D"&$contadoraux)
  88. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[5], "E"&$contadoraux)
  89. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[6], "F"&$contadoraux)
  90. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[7], "G"&$contadoraux)
  91. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[8], "H"&$contadoraux)
  92. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[9], "I"&$contadoraux)
  93. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[10], "J"&$contadoraux)
  94. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[11], "K"&$contadoraux)
  95. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[12], "L"&$contadoraux)
  96. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",$aRow[13], "M"&$contadoraux)
  97. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2",StringRight($aRow[1],5), "O"&$contadoraux)
  98. _Excel_RangeWrite($l_WorkbookEmitidos2, "HojaPrueba2","CORRD", "O1")
  99. WEnd
  100. _SQLite_QueryFinalize($hQuery)
  101. consolewrite("---------------SEGUNDA PARTE--------------------"&@CRLF)
  102. Local $hQuery1, $aRow1, $sMsg1
  103. Local $l_Excel3 = _Excel_Open()
  104. If @error Then
  105. MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 1", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
  106. Exit
  107. endif
  108. Local $l_WorkbookEmitidos3 = _Excel_BookNew ( $l_Excel3 , 1 )
  109. Local $ls_nombreExcel3="Maqueta "&StringMid($ls_nombreEmitidosaux,11,2)&" - "&StringMid($ls_nombreEmitidosaux,18,2)
  110. Local $ln_contador3=3
  111. _Excel_BookSaveAs($l_WorkbookEmitidos3, $ls_rutaMesa&"\"&$ls_nombreExcel3&").xls", $xlWorkbookDefault, True)
  112. _Excel_SheetAdd($l_WorkbookEmitidos3, -1, False, 5, "Resumen|TD|DATA RV| HT (RV)|MAQUETA FINAL")
  113. _Excel_SheetDelete($l_WorkbookEmitidos3, 1)
  114. _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")
  115. _SQLite_Query(-1, "SELECT d,e,SUM(n) FROM Emiciones group by e;", $hQuery1)
  116. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","RUC", "A3")
  117. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Razon Social", "B3")
  118. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL SOL", "C3")
  119. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL 12%", "D3")
  120. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","RUC", "A3")
  121. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Razon Social", "B3")
  122. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL SOL", "C3")
  123. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Suma de TOTAL 12%", "D3")
  124. Local $ln_suma=0
  125. Local $ln_suma_igv=0
  126. While _SQLite_FetchData($hQuery1, $aRow1) = $SQLITE_OK
  127. consolewrite($aRow1[0]&"-"&$aRow1[1]&"-"&$aRow1[2]&@CRLF)
  128. if StringStripWS($aRow1[0],8)<>"RUC" then
  129. $ln_contador3=$ln_contador3+1
  130. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[0], "A"&$ln_contador3)
  131. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[1], "B"&$ln_contador3)
  132. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$aRow1[2], "C"&$ln_contador3)
  133. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",0.12*$aRow1[2], "D"&$ln_contador3)
  134. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[0], "A"&$ln_contador3)
  135. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[1], "B"&$ln_contador3)
  136. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$aRow1[2], "C"&$ln_contador3)
  137. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",0.12*$aRow1[2], "D"&$ln_contador3)
  138. $ln_suma=$ln_suma+$aRow1[2]
  139. $ln_suma_igv=$ln_suma_igv+(0.12*$aRow1[2])
  140. endif
  141. WEnd
  142. $ln_contador3=$ln_contador3+1
  143. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen","Total General", "A"&$ln_contador3)
  144. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$ln_suma_igv, "D"&$ln_contador3)
  145. _Excel_RangeWrite($l_WorkbookEmitidos3, "Resumen",$ln_suma, "C"&$ln_contador3)
  146. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD","Total General", "A"&$ln_contador3)
  147. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$ln_suma_igv, "D"&$ln_contador3)
  148. _Excel_RangeWrite($l_WorkbookEmitidos3, "TD",$ln_suma, "C"&$ln_contador3)
  149. consolewrite("---------------TERCERA PARTE--------------------"&@CRLF)
  150. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","FACTURA", "A1")
  151. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Fecha Emisión", "B1")
  152. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","RUC", "C1")
  153. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Razón Social", "D1")
  154. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","TOTAL SOL", "E1")
  155. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","TOTAL 12%", "F1")
  156. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","No. Factura", "H1")
  157. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Razon social", "I1")
  158. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Cuenta B Nación", "J1")
  159. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Fecha documento", "K1")
  160. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","RUC", "L1")
  161. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Importe 12%", "M1")
  162. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","Moneda", "N1")
  163. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  164. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","No. Factura", "A1")
  165. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Razon social", "B1")
  166. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Cuenta B Nación", "C1")
  167. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Fecha documento", "D1")
  168. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","RUC", "E1")
  169. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Importe 12%", "F1")
  170. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Moneda", "G1")
  171. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "H1")
  172. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "I1")
  173. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "AB1")
  174. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "AC1")
  175. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order", "CI1")
  176. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Order2", "CJ1")
  177. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","C", "CT1")
  178. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","C", "CU1")
  179. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Canal", "EP1")
  180. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Cta Anti", "EQ1")
  181. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Texto", "ER1")
  182. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","FECHA DE ENVIO", "Q1")
  183. Local $ln_contador4=1
  184. Local $hQuery2, $aRow2, $sMsg2
  185. _SQLite_Query(-1, "SELECT * FROM Emiciones ;", $hQuery2)
  186. While _SQLite_FetchData($hQuery2, $aRow2) = $SQLITE_OK
  187. If StringStripWS($aRow2[3],8)<>"RUC" then
  188. $ln_contador4=$ln_contador4+1
  189. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[1], "A"&$ln_contador4)
  190. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[2], "B"&$ln_contador4)
  191. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[3], "C"&$ln_contador4)
  192. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[4], "D"&$ln_contador4)
  193. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[13], "E"&$ln_contador4)
  194. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",0.12*$aRow2[13], "F"&$ln_contador4)
  195. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G
  196. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[1], "H"&$ln_contador4)
  197. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[4], "I"&$ln_contador4)
  198. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","5720970303", "J"&$ln_contador4)
  199. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[2], "K"&$ln_contador4)
  200. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",$aRow2[3], "L"&$ln_contador4)
  201. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV",0.12*$aRow2[13], "M"&$ln_contador4)
  202. _Excel_RangeWrite($l_WorkbookEmitidos3, "DATA RV","PEN", "N"&$ln_contador4)
  203. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  204. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[1], "A"&$ln_contador4)
  205. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[4], "B"&$ln_contador4)
  206. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","5720970303", "C"&$ln_contador4)
  207. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",StringReplace($aRow2[2],"/",""), "D"&$ln_contador4)
  208. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "E"&$ln_contador4)
  209. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[13], "F"&$ln_contador4)
  210. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","PEN", "G"&$ln_contador4)
  211. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "H"&$ln_contador4)
  212. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","1", "I"&$ln_contador4)
  213. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","1", "J"&$ln_contador4)
  214. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","FB01", "K"&$ln_contador4)
  215. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","SA", "L"&$ln_contador4)
  216. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","0055", "M"&$ln_contador4)
  217. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","PEN", "N"&$ln_contador4)
  218. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "O"&$ln_contador4)
  219. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",StringReplace($aRow2[2],"/",""), "P"&$ln_contador4)
  220. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","'0"&@MDAY&StringReplace(@MON,"0","")&@YEAR, "Q"&$ln_contador4)
  221. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "R"&$ln_contador4)
  222. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3]&" - AUTODETRACCION RECARGAS", "S"&$ln_contador4)
  223. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "T"&$ln_contador4)
  224. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "U"&$ln_contador4)
  225. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION RECARGAS", "V"&$ln_contador4)
  226. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "W"&$ln_contador4)
  227. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","'02", "X"&$ln_contador4)
  228. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "Y"&$ln_contador4)
  229. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "Z"&$ln_contador4)
  230. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AA"&$ln_contador4)
  231. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "AB"&$ln_contador4)
  232. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "AC"&$ln_contador4)
  233. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "AD"&$ln_contador4)
  234. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","40", "AE"&$ln_contador4)
  235. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AF"&$ln_contador4)
  236. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "AG"&$ln_contador4)
  237. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "AH"&$ln_contador4)
  238. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AI"&$ln_contador4)
  239. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AJ"&$ln_contador4)
  240. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AK"&$ln_contador4)
  241. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AL"&$ln_contador4)
  242. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "AM"&$ln_contador4)
  243. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION "&$aRow2[4]&" "&$aRow2[1]&" ", "AN"&$ln_contador4)
  244. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AO"&$ln_contador4)
  245. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AP"&$ln_contador4)
  246. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AQ"&$ln_contador4)
  247. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AR"&$ln_contador4)
  248. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","5720970303", "AS"&$ln_contador4)
  249. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AT"&$ln_contador4)
  250. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AU"&$ln_contador4)
  251. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AV"&$ln_contador4)
  252. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AX"&$ln_contador4)
  253. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AY"&$ln_contador4)
  254. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "AZ"&$ln_contador4)
  255. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BA"&$ln_contador4)
  256. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BB"&$ln_contador4)
  257. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BC"&$ln_contador4)
  258. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BD"&$ln_contador4)
  259. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BE"&$ln_contador4)
  260. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BF"&$ln_contador4)
  261. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BG"&$ln_contador4)
  262. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BH"&$ln_contador4)
  263. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BI"&$ln_contador4)
  264. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BJ"&$ln_contador4)
  265. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BK"&$ln_contador4)
  266. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BL"&$ln_contador4)
  267. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BM"&$ln_contador4)
  268. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BN"&$ln_contador4)
  269. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BO"&$ln_contador4)
  270. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BP"&$ln_contador4)
  271. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BQ"&$ln_contador4)
  272. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BR"&$ln_contador4)
  273. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BS"&$ln_contador4)
  274. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BT"&$ln_contador4)
  275. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BU"&$ln_contador4)
  276. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BV"&$ln_contador4)
  277. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BX"&$ln_contador4)
  278. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BY"&$ln_contador4)
  279. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "BZ"&$ln_contador4)
  280. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CA"&$ln_contador4)
  281. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CB"&$ln_contador4)
  282. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CC"&$ln_contador4)
  283. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CD"&$ln_contador4)
  284. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CE"&$ln_contador4)
  285. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CF"&$ln_contador4)
  286. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CG"&$ln_contador4)
  287. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Asiento_1", "CH"&$ln_contador4)
  288. ;order 3
  289. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$ln_contador4-1, "CI"&$ln_contador4)
  290. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","3", "CJ"&$ln_contador4)
  291. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","2", "CK"&$ln_contador4)
  292. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","50", "CL"&$ln_contador4)
  293. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CM"&$ln_contador4)
  294. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "CN"&$ln_contador4)
  295. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",0.12*$aRow2[13], "CO"&$ln_contador4)
  296. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","D0", "CP"&$ln_contador4)
  297. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CQ"&$ln_contador4)
  298. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CR"&$ln_contador4)
  299. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CS"&$ln_contador4)
  300. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)",$aRow2[3], "CT"&$ln_contador4)
  301. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION "&$aRow2[4]&" "&$aRow2[1]&" ", "CU"&$ln_contador4)
  302. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CV"&$ln_contador4)
  303. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CX"&$ln_contador4)
  304. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "CY"&$ln_contador4)
  305. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","4739990000", "CZ"&$ln_contador4)
  306. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  307. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DA"&$ln_contador4)
  308. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DB"&$ln_contador4)
  309. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DC"&$ln_contador4)
  310. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DD"&$ln_contador4)
  311. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DE"&$ln_contador4)
  312. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DF"&$ln_contador4)
  313. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DG"&$ln_contador4)
  314. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DH"&$ln_contador4)
  315. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DI"&$ln_contador4)
  316. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DJ"&$ln_contador4)
  317. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DK"&$ln_contador4)
  318. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DL"&$ln_contador4)
  319. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DM"&$ln_contador4)
  320. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DN"&$ln_contador4)
  321. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DO"&$ln_contador4)
  322. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DP"&$ln_contador4)
  323. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DQ"&$ln_contador4)
  324. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DR"&$ln_contador4)
  325. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DS"&$ln_contador4)
  326. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DT"&$ln_contador4)
  327. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DU"&$ln_contador4)
  328. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DV"&$ln_contador4)
  329. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DX"&$ln_contador4)
  330. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DY"&$ln_contador4)
  331. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "DZ"&$ln_contador4)
  332. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EA"&$ln_contador4)
  333. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EB"&$ln_contador4)
  334. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EC"&$ln_contador4)
  335. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "ED"&$ln_contador4)
  336. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EE"&$ln_contador4)
  337. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EF"&$ln_contador4)
  338. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EG"&$ln_contador4)
  339. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EH"&$ln_contador4)
  340. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EI"&$ln_contador4)
  341. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EJ"&$ln_contador4)
  342. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EK"&$ln_contador4)
  343. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EL"&$ln_contador4)
  344. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EM"&$ln_contador4)
  345. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","/", "EN"&$ln_contador4)
  346. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Asiento_1", "EO"&$ln_contador4)
  347. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","Distribuidores", "EP"&$ln_contador4)
  348. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "EQ"&$ln_contador4)
  349. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "ER"&$ln_contador4)
  350. _Excel_RangeWrite($l_WorkbookEmitidos3, " HT (RV)","AUTODETRACCION", "ES"&$ln_contador4)
  351. endif
  352. WEnd
  353. $ln_contador4=$ln_contador4+1
  354. Local $ls_copia=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "H2:AA"&$ln_contador4)
  355. Local $ls_copia2=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "AB2:CH"&$ln_contador4)
  356. Local $ls_copia3=_Excel_RangeRead($l_WorkbookEmitidos3, " HT (RV)", "CI2:EO"&$ln_contador4)
  357. _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia,"A1")
  358. _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia2,"A"&($ln_contador4-1))
  359. _Excel_RangeWrite($l_WorkbookEmitidos3,"MAQUETA FINAL",$ls_copia3,"A"&(($ln_contador4*2)-3))
  360. _Excel_RangeSort($l_WorkbookEmitidos3, "MAQUETA FINAL", "A1:BG"&(($ln_contador4*3)-4), "A:A",Default, Default, $xlNo,Default,Default,"B:B",Default)
  361. _Excel_RangeDelete($l_WorkbookEmitidos3.ActiveSheet, "A1:B"&(($ln_contador4*3)-4), $xlShiftUp)
  362. Local $l_Excel4 = _Excel_Open()
  363. If @error Then
  364. MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 1", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
  365. Exit
  366. endif
  367. Local $ls_mes=StringMid($ls_nombreEmitidosaux,13,2)
  368. If $ls_mes="01" then
  369. $ls_mes="enero"
  370. endif
  371. If $ls_mes="02" then
  372. $ls_mes="febrero"
  373. endif
  374. If $ls_mes="03" then
  375. $ls_mes="marzo"
  376. endif
  377. If $ls_mes="04" then
  378. $ls_mes="abril"
  379. endif
  380. If $ls_mes="05" then
  381. $ls_mes="mayo"
  382. endif
  383. If $ls_mes="06" then
  384. $ls_mes="junio"
  385. endif
  386. If $ls_mes="07" then
  387. $ls_mes="julio"
  388. endif
  389. If $ls_mes="08" then
  390. $ls_mes="agosto"
  391. endif
  392. If $ls_mes="09" then
  393. $ls_mes="setiembre"
  394. endif
  395. If $ls_mes="10" then
  396. $ls_mes="octubre"
  397. endif
  398. If $ls_mes="11" then
  399. $ls_mes="noviembre"
  400. endif
  401. If $ls_mes="12" then
  402. $ls_mes="diciembre"
  403. endif
  404.  
  405. Local $ls_nombreExcel4=StringMid($ls_nombreEmitidosaux,11,2)&" - "&StringMid($ls_nombreEmitidosaux,18,2)&" "&$ls_mes& @YEAR&" Autodetraccion"
  406. Local $l_WorkbookEmitidos4 = _Excel_BookNew ( $l_Excel4 , 1 )
  407. Local $ls_copia4=_Excel_RangeRead($l_WorkbookEmitidos3, "MAQUETA FINAL", "C1:BG"&(($ln_contador4*3)-4))
  408. _Excel_RangeWrite($l_WorkbookEmitidos4,1,$ls_copia4,"A1")
  409. _Excel_BookSaveAs($l_WorkbookEmitidos4, $ls_rutaMesa&"\"&$ls_nombreExcel4&").xls", $xlWorkbookDefault, True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement