Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <link href="Site.css" rel="stylesheet" type="text/css" />
- <link href="../themes/redmond/jquery-ui-1.8.23.custom.css" rel="stylesheet" type="text/css" />
- <link href="../jt/themes/lightcolor/gray/jtable.css" rel="stylesheet" type="text/css" />
- <script src="../scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
- <script src="../scripts/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
- <script src="../jt/jquery.jtable.js" type="text/javascript"></script>
- </head>
- <body>
- <div id="ClientTableContainer" style="width: 950px; " align="center"></div>
- <script type="text/javascript">
- $(document).ready(function () {
- var spanishMessages = {
- serverCommunicationError: 'Error conectando al servidor',
- loadingMessage: 'Cargando...',
- noDataAvailable: 'Datos no disponibles!',
- addNewRecord: '+ Nuevo registro',
- editRecord: 'Editar',
- areYouSure: '¿Está seguro?',
- deleteConfirmation: 'Desea borrar los elementos seleccionados?',
- save: 'Guardar',
- saving: 'Guardando ...',
- cancel: 'Cancelar',
- deleteText: 'Borrar',
- deleting: 'Borrando',
- error: 'Error',
- close: 'Cerrar',
- cannotLoadOptionsFor: 'No se pueden cargar opciones para el campo {0} ',
- pagingInfo: 'Mostrando de {0} a {1} de {2} registros',
- canNotDeletedRecords: 'No se puede eliminar {0} de {1} registros!',
- deleteProggress: 'Borrando {0} de {1} registros, procesando...'
- };
- var spanishMessages2 = {
- serverCommunicationError: 'Error conectando al servidor',
- loadingMessage: 'Cargando...',
- noDataAvailable: 'Datos no disponibles!',
- addNewRecord: '+ Añadir producto',
- editRecord: 'Editar',
- areYouSure: '¿Está seguro?',
- deleteConfirmation: 'Desea borrar los elementos seleccionados?',
- save: 'Guardar',
- saving: 'Guardando ...',
- cancel: 'Cancelar',
- deleteText: 'Borrar',
- deleting: 'Borrando',
- error: 'Error',
- close: 'Cerrar',
- cannotLoadOptionsFor: 'No se pueden cargar opciones para el campo {0} ',
- pagingInfo: 'Mostrando de {0} a {1} de {2} registros',
- canNotDeletedRecords: 'No se puede eliminar {0} de {1} registros!',
- deleteProggress: 'Borrando {0} de {1} registros, procesando...'
- };
- //Prepare jTable
- $('#ClientTableContainer').jtable({
- title: 'Catalogo de Ventas ',
- messages: spanishMessages,
- paging: true,
- pageSize: 1000,
- sorting: true,
- selecting: false, //Enable selecting
- // multiselect: true, //Allow multiple selecting
- // selectingCheckboxes: true, //Show checkboxes on first column
- // selectOnRowClick: false, //Enable this to only select using checkboxes
- defaultSorting: 'Fecha_Venta DESC',
- openChildAsAccordion: true,
- actions: {
- listAction: 'ventas_sql.php?action=list',
- createAction: 'ventas_sql.php?action=create',
- updateAction: 'ventas_sql.php?action=update',
- deleteAction: 'ventas_sql.php?action=delete'
- },
- fields: {
- //CHILD TABLE DEFINITION FOR "DATOS-CLIENTE"
- Datos: {
- title: '',
- messages: spanishMessages2,
- width: '5%',
- sorting: false,
- edit: false,
- create: false,
- display: function (clientData) {
- //Create an image that will be used to open child table
- var $img = $('<img src="note.png" title="Editar Venta" />');
- //Open child table when user clicks the image
- $img.click(function () {
- $('#ClientTableContainer').jtable('openChildTable',
- $img.closest('tr'), //Parent row
- {
- title: 'Nº'+ clientData.record.ID_Venta + ' - Detalle de Venta',
- messages: spanishMessages,
- create: false,
- actions: {
- // listAction: '/Demo/ExamList?StudentId=' + clientData.record.StudentId,
- // listAction: 'clientes_sql_list.php?ID=' + clientData.record.ID_Cliente,
- listAction: 'ventas_sql_sub.php?action=list&ID=' + clientData.record.ID_Venta,
- //listAction: 'clientes_sql_list.php',
- deleteAction: 'ventas_sql_sub.php?action=delete',
- // updateAction: 'ventas_sql_sub.php?action=update&ID=' + clientData.record.ID_Venta,
- createAction: 'ventas_sql_sub.php?action=create&ID=' + clientData.record.ID_Venta,
- },
- fields: {
- ID_Venta: {
- type: 'hidden',
- defaultValue: clientData.record.ID_Venta
- },
- Cantidad: {
- title: 'Cantidad',
- width: '1%'
- },
- Descripcion: {
- title: 'Producto',
- width: '10%',
- create: false,
- //edit: false,
- //options: 'ventas_sql_sub.php?action=dropdown_producto',
- },
- DD_Producto: {
- list: false,
- edit: false,
- title: 'Producto',
- width: '10%',
- options: 'ventas_sql_sub.php?action=dropdown_producto',
- },
- IDT: {
- type: 'hidden',
- key: true,
- },
- Impuesto: {
- title: 'Impuesto',
- // width: '10%',
- },
- Descuento: {
- title: 'Descuento',
- // width: '10%',
- },
- Precio_Venta: {
- title: 'Precio de Venta',
- // width: '10%',
- },
- Subtotal: {
- title: 'Subtotal',
- create: false,
- edit: false,
- // width: '10%',
- },
- }
- }, function (data) { //opened handler
- data.childTable.jtable('load');
- });
- });
- //Return image to show on the person row
- return $img;
- }
- },
- ID_Venta: {
- key: true,
- create: false,
- edit: true,
- title: 'ID',
- width: '4%',
- //list: false
- },
- Nombre: {
- title: 'Cliente',
- width: '25%',
- create: false,
- edit: false,
- //options: 'ventas_sql_sub.php?action=dropdown_cliente',
- },
- DD_Cliente: {
- list: false,
- title: 'Cliente',
- width: '10%',
- options: 'ventas_sql.php?action=dropdown_cliente',
- },
- Fecha_Venta: {
- title: 'Fecha de Venta',
- width: '12%',
- type: 'date',
- displayFormat: 'yy-mm-dd'
- // sorting: false,
- },
- Nombre_Moneda: {
- title: 'Moneda',
- width: '10%',
- sorting: false,
- create: false,
- edit: false,
- //options: 'ventas_sql.php?action=dropdown_moneda',
- //defaultValue: 'ventas_sql.php?action=list'
- },
- DD_Moneda: {
- list: false,
- title: 'Moneda',
- width: '10%',
- options: 'ventas_sql.php?action=dropdown_moneda',
- },
- Precio_Total: {
- title: 'Importe Total',
- width: '15%',
- sorting: true,
- create: false,
- edit: false,
- //options: 'ventas_sql.php?action=dropdown_moneda',
- //defaultValue: 'ventas_sql.php?action=list'
- }
- }
- });
- //Load person list from server
- $('#ClientTableContainer').jtable('load');
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement