Advertisement
EmilianoRoldanR

Crear formato factura Ticket

Jan 30th, 2021
3,945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 4.05 KB | None | 0 0
  1. -- Cambiar los valores de las variables pero SIN ELIMINAR LAS COMILLAS.
  2.  
  3. DECLARE @EQUIPO VARCHAR(40)= /*NOMBRE DE EQUIPO*/ 'DESKTOP-JPIDFDS';
  4. DECLARE @RAZON_SOCIAL VARCHAR(40)= /*RAZON SOCIAL*/'"ALEJANDRA MUÑOZ"'
  5. DECLARE @NOMBRE_FANTASIA VARCHAR(40)= /*NOMBRE FANTASIA*/ '"ESPACIO GOURMET"';
  6. DECLARE @RUT VARCHAR(40)= /*NUMERO DE RUT*/'"217291490015"';
  7. DECLARE @DIRECCION VARCHAR(40)= /*DIRECCION*/'"26 DE MARZO 1267"';
  8.  
  9. -- CREO MI CLIENTE PREDETERMINADO.
  10. INSERT INTO clientes VALUES ('predeterminado', '.', '.', '', 'X', '', 'URUGUAY', '', '', '', NULL, 0, 0, 0, '', '', '', 1, 0, 0, '.', '', '', '', '', '', '', 0, '', 1, '', '', NULL, NULL, 0, 1, 0, NULL, 0, '', 1, '');
  11.  
  12. -- CREO EL FORMATO FACTURA NUMERO 7 (Puse ese numero para que quede alejado de la realidad).
  13. INSERT INTO formatofacturas_padre VALUES (7, 'FORMATO F-TICKET', 1,16);
  14.  
  15. -- CREO MI FOLIO FACTURA.
  16. INSERT INTO foliosfacturas (serie, ultimofolio, electronico, consecutivoinicio, consecutivofin, anioaprobacion, numaprobacion, estatus, cbb, tipoesquema, idempresa, fechaaprobacion, ultimofoliocentral, Des_GT_folioguatemala, Des_GT_fechaaprobacion, Des_GT_fechaingreso, Des_GT_fechavigencia, Des_GT_avisovencimiento, complementopago)
  17. VALUES ('E', 0, 0, 1, 9999999999, 2021, '', 1, '', 0, 0000000001, NULL, NULL, 0, '2021-01-30T23:59:59', '2021-01-30T23:59:59', '2021-01-30T23:59:59', 0, 0);
  18.  
  19. -- ASIGNO MI FOLIO FACTURA, BAJO LAS COPIAS A 0 Y LE DIGO AL PROGRAMA QUE AL IMPRIMIR ASIGNE EL FORMATO 7.
  20. --      ***IMPORTANTE*** ACA HAY que saber el nombre de la estacion en la que se va a utilizar esto por que sin el WHERE se los asigna a todos.
  21. UPDATE estaciones SET seriefacturacion = 'E', idformatofacturafiscal = 7, idformatofacturapublico = 7,  copiasticketcomedor = 0, copiasticketdomicilio = 0, copiasticketrapido = 0 WHERE idestacion = @EQUIPO;
  22.  
  23. --EMPIEZO CON LA FACTURA
  24. INSERT INTO formatofacturas VALUES (7, 0, 0, @NOMBRE_FANTASIA, 1);
  25. INSERT INTO formatofacturas VALUES (7, 1, 0, @RAZON_SOCIAL, 1);
  26. INSERT INTO formatofacturas VALUES (7, 2, 0, @RUT, 1);
  27. INSERT INTO formatofacturas VALUES (7, 3, 0, @DIRECCION , 1);
  28. INSERT INTO formatofacturas VALUES (7, 4, 0, '"ORDEN: "+ALLTRIM(CURCHEQUES.ORDEN)', 1);
  29. INSERT INTO formatofacturas VALUES (7, 4, 24, '"FOLIO: "', 1);
  30. INSERT INTO formatofacturas VALUES (7, 4, 31, 'TRANSFORM(FOLIO,"999999")', 1);
  31. INSERT INTO formatofacturas VALUES (7, 5, 0, '"FECHA: "', 1);
  32. INSERT INTO formatofacturas VALUES (7, 5, 24, 'DTOC(FECHA)', 1);
  33. INSERT INTO formatofacturas VALUES (7, 6, 0, '"MESA: "', 1);
  34. INSERT INTO formatofacturas VALUES (7, 6, 7, 'ALLTRIM(CURCHEQUES.MESA)', 1);
  35. INSERT INTO formatofacturas VALUES (7, 7, 0, '"CLIENTE: "', 1);
  36. INSERT INTO formatofacturas VALUES (7, 7, 10, 'SUBSTR(NOMBRE,1,25)', 1);
  37. INSERT INTO formatofacturas VALUES (7, 8, 0, '"RUT: " + RFC', 1);
  38. INSERT INTO formatofacturas VALUES (7, 9, 0, '"DIRECCION: "', 1);
  39. INSERT INTO formatofacturas VALUES (7, 9, 12, 'SUBSTR(DIRECCION,1,20)', 1);
  40. INSERT INTO formatofacturas VALUES (7, 12, 0, '"CANT. DESCRIPCION            IMPORTE "', 1);
  41. INSERT INTO formatofacturas VALUES (7, 13, 0, '"==================================   "', 1);
  42.  
  43.  
  44. INSERT INTO formatofacturas VALUES (7, 14, 1, 'TRANSFORM(CANTIDAD,"999")', 2);
  45. INSERT INTO formatofacturas VALUES (7, 14, 6, 'SUBSTR(DESCRIPCION,1,25)', 2);
  46. INSERT INTO formatofacturas VALUES (7, 14, 31, 'TRANSFORM(ROUND(TOTALCONIMPUESTO,2),"@$ 999,999,999,999.99")', 2);
  47.  
  48.  
  49. INSERT INTO formatofacturas VALUES (7, 16, 0, '"SUBTOTAL: "', 3);
  50. INSERT INTO formatofacturas VALUES (7, 16, 31, 'TRANSFORM(SUBTOTAL,"@$ 999,999,999,999.99")', 3);
  51. INSERT INTO formatofacturas VALUES (7, 17, 0, '"IVA:"', 3);
  52. INSERT INTO formatofacturas VALUES (7, 17, 31, 'TRANSFORM(IMPUESTO,"@$ 999,999,999,999.99")', 3);
  53. INSERT INTO formatofacturas VALUES (7, 18, 0, 'TOTAL: ', 3);
  54. INSERT INTO formatofacturas VALUES (7, 18, 31, 'TRANSFORM(TOTAL,"@$ 999,999,999,999.99")', 3);
  55. INSERT INTO formatofacturas VALUES (7, 27, 0, 'CHR(27) +CHR(105)', 3);
  56.  
  57.  
  58. ****DESPUES DE LA CONSULTA LO QUE HAY QUE HACER ES PONER A MANO EL CLIENTE PREDETERMINADO(Que lo crea la sentencia) Y SOLICITA FACTURACION Y NADA MAS***
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement