require_once('../include/orm.php'); require_once('../include/globals.php'); require_once('../include/util.php'); $_import_formatoreconocimiento_db_connected = $Link == ''; if($_import_formatoreconocimiento_db_connected) $Link = connectDb(); define('DBCONNECTED', 1); debugstartpage(); //$_inmenusistemas/Importacion = 'yes'; if( isset($_x) ) { //if( $_x != '' ) { $_x = $_x == '' ? array() : StringTokenize($_x, ","); $_result = array(); $_result['version'] = array('actual' => 38); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../main/base.events.php'); $_morecolumns = ""; if( !isset($_id) and $id != '' ) $_id = rand(1, 100000000); $formatoreconocimiento = sessionget('form_formatoreconocimiento_formatoreconocimiento' . $_id); //logToFile('formatoreconocimiento: ' . print_r($formatoreconocimiento, true)); if( empty($_x) or in('onopen', $_x) ) { if( $id != "" and $id != "0" ) { $formatoreconocimiento = loadObject($Link, "import.formatoreconocimiento", $id); } else { $formatoreconocimiento = newObject($Link, "import.formatoreconocimiento"); //fillobjectfromrequest($formatoreconocimiento); } } if( isormObject($formatoreconocimiento) ) updateObjectFromRequest($Link, $formatoreconocimiento); //makeglobals($formatoreconocimiento, array('id', 'formatoreconocimiento')); if( isset($_x) ) $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); //$_initialvars['formatoreconocimiento'] = objectToStructure($formatoreconocimiento); if( isormObject($formatoreconocimiento) ) $_initialvars = array_merge($_initialvars, objectToStructure($formatoreconocimiento)); if( isormObject($formatoreconocimiento) ) $formatoreconocimiento->makeglobals(); //logToFile('formatoreconocimiento after uofr: ' . print_r($formatoreconocimiento, true)); // isbasewindow: // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__formatoreconocimiento__1'] = ($id != "" and $id != "0" ) ? 'form-readonly readonly' : '' ; $__row0['__formatoreconocimiento__2'] = ($id == "" ) ? 'listmode' : 'editmode' ; $__row0['__formatoreconocimiento__3'] = $_id ; $__row0['__formatoreconocimiento__4'] = $id == '0' ? 'Nuevo ' : '' ; $__row0['__formatoreconocimiento__5'] = $id > 0 ? ('#' . $id) : '' ; $__row0['__formatoreconocimiento__6'] = buildUrlQueryFromGet(array('id' => '0', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__formatoreconocimiento__7'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__formatoreconocimiento__8'] = $s_access['modificacion'] ; $__row0['__formatoreconocimiento__9'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__nombre__1'] = $formatoreconocimiento->nombre ; $__row0['__proveedor__1'] = $formatoreconocimiento->contacto->id ; $__row0['__proveedor__2'] = genSelectOptionsDb($Link, "select id , codigo,grupoempresario,razonsocial,nombrecomercial,cuit,codigo,grupoempresario,razonsocial,nombrecomercial,cuit from cmcont where (tipo like '%Proveedor' and razonsocial is not null) order by codigo, grupoempresario, razonsocial, nombrecomercial, cuit, codigo, grupoempresario, razonsocial, nombrecomercial, cuit", "", "- Seleccionar -"); ; $__row0['__mail__1'] = $formatoreconocimiento->mail ; $__row0['__comentarios__1'] = encodehtml($formatoreconocimiento->comentarios) ; $_result['morevars'] = $__row0; break; } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { require_once('../include/fpdfreport.php'); $_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' )); $_pdf->initialPage = ($_page != '' ? $_page : 1); //$_pdf->SetAutoPageBreak(true); $_pdf->title = "Formato para reconocimiento"; $_pdf->SetTopMargin(50); $_pdf->AliasNbPages(); $_pdf->AddPage(); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->title = "Formato de reconocimiento"; //$_pdf->drawText("Formato de reconocimiento",'Arial','',14); } if( has($_x, 'formatoreconocimiento_list') ) { if( $_reorder != '' ) { $_changes = split('/', $_reorder); foreach($_changes as $_change) { $_change0 = split('-', $_change); $_id = $_change0[0]; $_position = $_change0[1]; $_table = 'imreconformat'; sqlexec($Link, "update $_table set position = $_position where id = $_id"); } } //logToFile('[formatoreconocimiento_list] ' . print_r($_REQUEST, true) ); $q = $search['value']; $_order = "order by " . ($order[0]['column'] + 1) . " " . $order[0]['dir']; if( $order[0]['column'] == '' ) $_order = $orderby ; if( $start == '' ) $start = 0; if( $length == '' ) $length = 50; else if( $length == '-1' ) $length = 10000; $_additionalfilter = substr(getaccess(getSelfWindow(), 'buscar'), 14); if( trim($_additionalfilter) == '' ) $_additionalfilter = '1 = 1'; if( hasfeature('import.formatoreconocimiento', 'procesos') ) $_morecolumns = ", status"; if( isset($my) and $my == 'mine' ) { if( isset($status) ) $_order = " and (select count(*) from emresp where form = 'import.formatoreconocimiento' and objeto = imreconformat.id and usuario = '$s_idusuario' and estado = '$status') > 0 " . $_order; else $_order = " and (select count(*) from emresp where form = 'import.formatoreconocimiento' and objeto = imreconformat.id and usuario = '$s_idusuario') > 0 " . $_order; } if( isset($status) ) $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS imreconformat.id, imreconformat.nombre, (select temp.codigo from cmcont as temp where temp.id = imreconformat.contacto) as contacto, imreconformat.mail $_morecolumns from imreconformat where ($_additionalfilter) and (imreconformat.status = '" . mysql_escape($status) . "') $_order limit $start, $length"); else $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS imreconformat.id, imreconformat.nombre, (select temp.codigo from cmcont as temp where temp.id = imreconformat.contacto) as contacto, imreconformat.mail $_morecolumns from imreconformat where ($_additionalfilter) $_order limit $start, $length"); $_result['draw'] = 0; $_result['recordsTotal'] = sqlget($Link, "select found_rows()"); $_result['recordsFiltered'] = $_result['recordsTotal']; //sizeof($_result['data']); //$_result['recordsFiltered'] = 50; print(json_encode($_result)); disconnectDb($Link); exit(0); } // aca iba session get, uofr y load/saveobject while( has($_x, 'formatoreconocimiento_init') ) { $_result['formatoreconocimiento'] = $formatoreconocimiento->toarray(false); break; } while( has($_x, 'formatoreconocimiento') ) { $formatoreconocimiento->saveChanges(); //if( $errors == "" ) // validateformatoreconocimiento(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($formatoreconocimiento)); saveObject($Link, $formatoreconocimiento); if( hasfeature('import.formatoreconocimiento', 'procesos') ) { require_once('../include/easyflexa.php'); if( $id == 0 ) setresponsables($formatoreconocimiento); controlstatus($formatoreconocimiento); } $id = $formatoreconocimiento->id; //logToFile(objectToText($formatoreconocimiento)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_formatoreconocimiento_formatoreconocimiento' . $_id, $formatoreconocimiento); if( $_result['redirect'] == '' ) redirect("?id=$id"); } break; } while( has($_x, 'formatoreconocimiento__delete') ) { //if( $errors == "" ) // validateformatoreconocimiento(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($formatoreconocimiento)); deleteObject($Link, $formatoreconocimiento); //logToFile(objectToText($formatoreconocimiento)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_formatoreconocimiento_formatoreconocimiento' . $_id, null); if( $_result['redirect'] == '' ) { $_result['redirect'] = "?message=Formato de reconocimiento eliminado"; } } break; } while( has($_x, 'formatoreconocimiento_unload') ) { // Not used sessionclear('form_formatoreconocimiento_formatoreconocimiento' . $_id); break; } if( has($_x, 'section1') ) { } if( has($_x, 'formulario_select') ) { list($_result['formulario_select'], $_result['formulario_columns'], $_result['formulario_types']) = sqltoarraydd($Link, "select concat(module, '.', name) as id, concat(module, '.', name) as name from ddform group by module, name order by module, name "); } if( has($_x, 'proveedor_select') ) { list($_result['proveedor_select'], $_result['proveedor_columns'], $_result['proveedor_types']) = sqltoarraydd($Link, "select id , codigo,grupoempresario,razonsocial,nombrecomercial,cuit,codigo,grupoempresario,razonsocial,nombrecomercial,cuit from cmcont where (tipo like '%Proveedor' and razonsocial is not null) order by codigo, grupoempresario, razonsocial, nombrecomercial, cuit, codigo, grupoempresario, razonsocial, nombrecomercial, cuit limit 500"); } if( has($_x, 'reconocimiento') ) { } if( $reconocimiento__row != '' ) { $formatoreconocimiento->reconocimiento->_selected = $reconocimiento__row; } if( has($_x, 'reconocimiento_donde_select') ) { /** * derecha,abajo A la derecha de,Debajo de */ $_result['reconocimiento_donde_select'] = [["derecha","A la derecha de"],["abajo","Debajo de"]]; } if( has($_x, 'reconocimiento_guardaren_select') ) { list($_result['reconocimiento_guardaren_select'], $_result['reconocimiento_guardaren_columns'], $_result['reconocimiento_guardaren_types']) = sqltoarraydd($Link, "select concat(if(form like '%.%',concat(replace(form, 'comprobanteProveedor.',''), '.'), ''),name) as name, concat(replace(replace(form, 'comprobanteProveedor', ''), '.', ''), ' ', title, ' (', name, ')') as title from ddfield where module = 'compras' and form like 'comprobanteProveedor%' and type != 'table' order by numero "); } sessionset('form_formatoreconocimiento_formatoreconocimiento' . $_id, $formatoreconocimiento); //$formatoreconocimiento -> ['changes'] if( isormObject($formatoreconocimiento) ) $formatoreconocimiento->makeglobals(); if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> if( !isset($_x) ) { ?> if( isset($_export) ) { ?> header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=formatoreconocimiento.xls"); //echo(''); //echo(''); echo(''); ?> } else { ?>
require('../main/base.head.php'); ?>