Exemple #1
0
    function datagserchi()
    {
        $this->rapyd->load('dataedit');
        $mgas = array('tabla' => 'mgas', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'tipo' => 'Tipo'), 'filtro' => array('descrip' => 'Descripción'), 'retornar' => array('codigo' => 'codigo', 'descrip' => 'descrip'), 'titulo' => 'Buscar enlace administrativo');
        $bcodigo = $this->datasis->modbus($mgas);
        $ivas = $this->datasis->ivaplica();
        $tasa = $ivas['tasa'] / 100;
        $redutasa = $ivas['redutasa'] / 100;
        $sobretasa = $ivas['sobretasa'] / 100;
        $consulrif = $this->datasis->traevalor('CONSULRIF');
        $script = "\n\t\tfunction consulrif(){\n\t\t\tvrif=\$('#rif').val();\n\t\t\tif(vrif.length==0){\n\t\t\t\talert('Debe introducir primero un RIF');\n\t\t\t}else{\n\t\t\t\tvrif=vrif.toUpperCase();\n\t\t\t\t\$('#rif').val(vrif);\n\t\t\t\twindow.open('{$consulrif}'+'?p_rif='+vrif,'CONSULRIF','height=350,width=410');\n\t\t\t}\n\t\t}\n\n\t\tfunction poneiva(tipo){\n\t\t\tif(tipo==1){\n\t\t\t\tptasa = {$redutasa};\n\t\t\t\tcampo = 'reducida';\n\t\t\t\tmonto = 'monredu';\n\t\t\t} else if (tipo==3){\n\t\t\t\tptasa = {$sobretasa};\n\t\t\t\tcampo = 'sobretasa';\n\t\t\t\tmonto = 'monadic'\n\t\t\t} else {\n\t\t\t\tptasa = {$tasa};\n\t\t\t\tcampo = 'tasa';\n\t\t\t\tmonto = 'montasa';\n\t\t\t}\n\t\t\tif(\$('#'+monto).val().length>0)  base=parseFloat(\$('#'+monto).val());   else  base  =0;\n\t\t\t\$('#'+campo).val(roundNumber(base*ptasa,2));\n\t\t\ttotaliza();\n\t\t}\n\n\t\tfunction totaliza(){\n\t\t\tif(\$('#montasa').val().length>0)   montasa  =parseFloat(\$('#montasa').val());   else  montasa  =0;\n\t\t\tif(\$('#tasa').val().length>0)      tasa     =parseFloat(\$('#tasa').val());      else  tasa     =0;\n\t\t\tif(\$('#monredu').val().length>0)   monredu  =parseFloat(\$('#monredu').val());   else  monredu  =0;\n\t\t\tif(\$('#reducida').val().length>0)  reducida =parseFloat(\$('#reducida').val());  else  reducida =0;\n\t\t\tif(\$('#monadic').val().length>0)   monadic  =parseFloat(\$('#monadic').val());   else  monadic  =0;\n\t\t\tif(\$('#sobretasa').val().length>0) sobretasa=parseFloat(\$('#sobretasa').val()); else  sobretasa=0;\n\t\t\tif(\$('#exento').val().length>0)    exento   =parseFloat(\$('#exento').val());    else  exento   =0;\n\n\t\t\ttotal=roundNumber(montasa+tasa+monredu+reducida+monadic+sobretasa+exento,2);\n\t\t\t\$('#importe').val(total);\n\t\t}";
        $edit = new DataEdit('Gastos de caja chica', 'gserchi');
        $edit->back_url = site_url('finanzas/gser/gserchi');
        $edit->script($script, 'create');
        $edit->script($script, 'modify');
        $edit->pre_process('insert', '_pre_gserchi');
        $edit->pre_process('update', '_pre_gserchi');
        $edit->codbanc = new dropdownField('Código de la caja', 'codbanc');
        $edit->codbanc->option('', 'Seleccionar');
        $edit->codbanc->options("SELECT codbanc, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE tbanco='CAJ' ORDER BY codbanc");
        $edit->codbanc->rule = 'max_length[5]|required';
        $edit->fechafac = new dateField('Fecha de la factura', 'fechafac');
        $edit->fechafac->rule = 'max_length[10]|required';
        $edit->fechafac->size = 12;
        $edit->fechafac->insertValue = date('Y-m-d');
        $edit->fechafac->maxlength = 10;
        $edit->numfac = new inputField('Número de la factura', 'numfac');
        $edit->numfac->rule = 'max_length[8]|required';
        $edit->numfac->size = 10;
        $edit->numfac->maxlength = 8;
        $edit->numfac->autocomplete = false;
        $edit->nfiscal = new inputField('Control fiscal', 'nfiscal');
        $edit->nfiscal->rule = 'max_length[12]|required';
        $edit->nfiscal->size = 14;
        $edit->nfiscal->maxlength = 12;
        $edit->nfiscal->autocomplete = false;
        $lriffis = '<a href="javascript:consulrif();" title="Consultar RIF en el SENIAT" onclick="">Consultar RIF en el SENIAT</a>';
        $edit->rif = new inputField('RIF', 'rif');
        $edit->rif->rule = 'max_length[13]|required';
        $edit->rif->size = 13;
        $edit->rif->maxlength = 13;
        $edit->rif->group = 'Datos del proveedor';
        $edit->rif->append(HTML::button('traesprv', 'Consultar Proveedor', '', 'button', 'button'));
        $edit->rif->append($lriffis);
        $edit->proveedor = new inputField('Nombre del proveedor', 'proveedor');
        $edit->proveedor->rule = 'max_length[40]|strtoupper';
        $edit->proveedor->size = 40;
        $edit->proveedor->group = 'Datos del proveedor';
        $edit->proveedor->maxlength = 40;
        $edit->codigo = new inputField('C&oacute;digo del gasto', 'codigo');
        $edit->codigo->rule = 'max_length[6]|required';
        $edit->codigo->size = 6;
        $edit->codigo->maxlength = 8;
        $edit->codigo->append($bcodigo);
        $edit->descrip = new inputField('Descripci&oacute;n', 'descrip');
        $edit->descrip->rule = 'max_length[50]|strtoupper';
        $edit->descrip->size = 50;
        $edit->descrip->maxlength = 50;
        $arr = array('exento' => 'Monto <b>Exento</b>|Base exenta', 'montasa' => 'Montos con Alicuota <b>general</b>|Base imponible', 'tasa' => 'Montos con Alicuota <b>general</b>|Monto del IVA', 'monredu' => 'Montos con Alicuota <b>reducida</b>|Base imponible', 'reducida' => 'Montos con Alicuota <b>reducida</b>|Monto del IVA', 'monadic' => 'Montos con Alicuota <b>adicional</b>|Base imponible', 'sobretasa' => 'Montos con Alicuota <b>adicional</b>|Monto del IVA', 'importe' => 'Importe total');
        foreach ($arr as $obj => $label) {
            $pos = strrpos($label, '|');
            if ($pos !== false) {
                $piv = explode('|', $label);
                $label = $piv[1];
                $grupo = $piv[0];
            } else {
                $grupo = '';
            }
            $edit->{$obj} = new inputField($label, $obj);
            $edit->{$obj}->rule = 'max_length[17]|numeric';
            $edit->{$obj}->css_class = 'inputnum';
            $edit->{$obj}->insertValue = 0;
            $edit->{$obj}->size = 17;
            $edit->{$obj}->maxlength = 17;
            $edit->{$obj}->group = $grupo;
            $edit->{$obj}->autocomplete = false;
        }
        $edit->{$obj}->readonly = true;
        $edit->tasa->rule = 'condi_required|max_length[17]|callback_chtasa';
        $edit->reducida->rule = 'condi_required|max_length[17]|callback_chreducida';
        $edit->sobretasa->rule = 'condi_required|max_length[17]|callback_chsobretasa';
        $edit->importe->rule = 'max_length[17]|numeric|positive';
        $edit->sucursal = new dropdownField('Sucursal', 'sucursal');
        $edit->sucursal->options('SELECT codigo,sucursal FROM sucu ORDER BY sucursal');
        $edit->sucursal->rule = 'max_length[2]|required';
        $edit->departa = new dropdownField('Departamento', 'departa');
        $edit->departa->options("SELECT codigo, CONCAT_WS('-',codigo,departam) AS label FROM dept ORDER BY codigo");
        $edit->departa->rule = 'max_length[2]';
        $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario'));
        $edit->estampa = new autoUpdateField('estampa', date('YmD'), date('Ymd'));
        $edit->hora = new autoUpdateField('hora', date('H:m:s'), date('H:m:s'));
        $edit->buttons('modify', 'save', 'undo', 'delete', 'back');
        $edit->build();
        $url = site_url('finanzas/gser/ajaxsprv');
        //$this->rapyd->jquery[]='$(".inputnum").bind("keyup",function() { totaliza(); })';
        $this->rapyd->jquery[] = '$(".inputnum").numeric(".");';
        $this->rapyd->jquery[] = '$("#exento"   ).bind("keyup",function() { totaliza(); })';
        $this->rapyd->jquery[] = '$("#montasa"  ).bind("keyup",function() { poneiva(2); })';
        $this->rapyd->jquery[] = '$("#tasa"     ).bind("keyup",function() { totaliza(); })';
        $this->rapyd->jquery[] = '$("#monredu"  ).bind("keyup",function() { poneiva(1); })';
        $this->rapyd->jquery[] = '$("#reducida" ).bind("keyup",function() { totaliza(); })';
        $this->rapyd->jquery[] = '$("#monadic"  ).bind("keyup",function() { poneiva(3); })';
        $this->rapyd->jquery[] = '$("#sobretasa").bind("keyup",function() { totaliza(); })';
        $this->rapyd->jquery[] = '$("input[name=\'traesprv\']").click(function() {
			rif=$("#rif").val();
			if(rif.length > 0){
				$.post("' . $url . '", { rif: rif },function(data){
					$("#proveedor").val(data);
				});
			}else{
				alert("Debe introducir un rif");
			}
		});';
        $data['content'] = $edit->output;
        $data['title'] = heading('Agregar/Modificar facturas de Caja Chica');
        $data['head'] = $this->rapyd->get_head();
        $data['head'] .= phpscript('nformat.js');
        $this->load->view('view_ventanas', $data);
    }
Exemple #2
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (empty($args['url'])) {
         return '';
     }
     extract($args);
     $posted = $GLOBALS['HTTP_POST_VARS'];
     if (in_array('url', array_keys($posted))) {
         $s = $posted['s'];
         $this->_url = $posted['url'];
         $this->_getInterWikiUrl($request);
         if (strstr($this->_url, '%s')) {
             $this->_url = sprintf($this->_url, $s);
         } else {
             $this->_url .= $s;
         }
         if (defined('DEBUG') && DEBUG && $debug) {
             trigger_error("redirect url: " . $this->_url);
         } else {
             $request->redirect($this->_url);
             //no return!
         }
     }
     $this->_name = $name;
     $this->_s = $s;
     if ($formsize < 1) {
         $formsize = 30;
     }
     $this->_url = $url;
     $this->_getInterWikiUrl($request);
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('pagename' => $basepage)));
     $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'url', 'value' => $this->_url)));
     $s = HTML::input(array('type' => 'text', 'value' => $this->_s, 'name' => 's', 'size' => $formsize));
     if (!empty($args["useimage"])) {
         //FIXME: This does not work with Gecko
         $button = HTML::img(array('src' => $useimage, 'alt' => 'imagebutton'));
         if (!empty($width)) {
             $button->setAttr('width', $width);
         }
         if (!empty($height)) {
             $button->setAttr('height', $height);
         }
         // on button_position => none display no input form
         if ($button_position == 'right') {
             $form->pushContent($s);
         }
         $form->pushContent(HTML::button(array('type' => 'button', 'class' => 'button', 'value' => $this->_name), $button));
         if ($button_position == 'left') {
             $form->pushContent($s);
         }
     } else {
         if ($button_position != 'left' and $button_position != 'right') {
             return $this->error(fmt("Invalid argument: %s=%s", 'button_position', $button_position));
         }
         $button = HTML::input(array('type' => 'submit', 'class' => 'button', 'value' => $this->_name));
         if ($button_position == 'left') {
             $form->pushContent($button);
             $form->pushContent($s);
         } elseif ($button_position == 'right') {
             $form->pushContent($s);
             $form->pushContent($button);
         }
     }
     return $form;
 }
Exemple #3
0
     }
     if (isset($checkbox5)) {
         array_push($checkbox, $checkbox5);
     }
     $data_html = $obj->checkbox($var_name, $label, $checkbox, $div_name);
     $data_css = $obj_css->styles($var_name, $color, $width, $height, $x_position, $y_position, $z_index, $font_size, $font_color);
     $obj->write_to_file($data_html, $html_file_name, $css_file_name, $data_css);
     $insert = "INSERT INTO `CMS`.`html_css` (`ID`, `HTML`, `CSS`,  `FORM_ID`,`STATUS`, `NAME`) VALUES (NULL, '{$data_html}', '{$data_css}', {$index_of_form},'1', '{$label}');";
     $result = $conn->query($insert);
     $ID = mysqli_insert_id($conn);
     $insert_div_data = "INSERT INTO `CMS`.`divs` (`ID`, `ELEMENT`, `HTML_CSS_ID`) VALUES (NULL, '{$data_html}',{$ID});";
     $result = $conn->query($insert_div_data);
     echo 'HTML & CSS Code created successfully<br/>';
     break;
 case 'button':
     $data_html = $obj->button($var_name, $label, $value, $div_name);
     $data_css = $obj_css->styles($var_name, $color, $width, $height, $x_position, $y_position, $z_index, $font_size, $font_color);
     $obj->write_to_file($data_html, $html_file_name, $css_file_name, $data_css);
     $insert = "INSERT INTO `CMS`.`html_css` (`ID`, `HTML`, `CSS`,  `FORM_ID`,`STATUS`, `NAME`) VALUES (NULL, '{$data_html}', '{$data_css}', {$index_of_form},'1', '{$label}');";
     $result = $conn->query($insert);
     $ID = mysqli_insert_id($conn);
     $insert_div_data = "INSERT INTO `CMS`.`divs` (`ID`, `ELEMENT`, `HTML_CSS_ID`) VALUES (NULL, '{$data_html}',{$ID});";
     $result = $conn->query($insert_div_data);
     echo 'HTML & CSS Code created successfully<br/>';
     break;
 case 'select':
     $select = array();
     if (isset($select1)) {
         array_push($select, $select1);
     }
     if (isset($select2)) {
Exemple #4
0
/**
 * Returns HTML code for a button element. It may include an icon element and a title text.
 * 
 * @param  string $title The button title text
 * @param  string $url   The URL the button is targeting at
 * @param  string $icon  The name of the icon. It's rendered by an icon font.
 * @param  array  $options  Apply these HTML attributes to the link element
 * @return string
 */
function button($title, $url, $icon = '', $options = array())
{
    return HTML::button($title, $url, $icon);
}
/* @var $permission yii\rbac\Permission */
echo $this->render('/default/_navigation', []);
use yii\helpers\Html;
?>

<div class="row">
	<div class="col-xs-12">
		<?php 
echo HTML::beginForm(['update', 'id' => $permission->name]);
?>
		<div class="row">
			<div class="col-xs-4">
				<?php 
echo HTML::label('Beschreibung');
?>
			</div>
			<div class="col-xs-8">
				<?php 
echo HTML::textInput('description', $permission->description, ['class' => 'form-control']);
?>
			</div>
		</div>
		<?php 
echo HTML::button('Speichern', ['type' => 'submit', 'class' => 'btn btn-primary']);
?>
		<?php 
echo HTML::endForm();
?>
	</div>
</div>
/* @var $permission yii\rbac\Permission */
use yii\helpers\Html;
echo $this->render('/default/_navigation', []);
?>

<?php 
echo HTML::beginForm(['create']);
?>

<div class="form-group">
	<?php 
echo HTML::label('Name');
?>
	<?php 
echo HTML::textInput('name', '');
?>
</div>

<div class="form-group">
	<?php 
echo HTML::label('Beschreibung');
?>
	<?php 
echo HTML::textInput('description', '');
?>
</div>

<?php 
echo HTML::button('Speichern', ['type' => 'submit']);
echo HTML::endForm();
Exemple #7
0
 function ejecutar()
 {
     $this->rapyd->load('datagrid2', 'fields');
     function dif($a, $b)
     {
         return number_format($a - $b, 2, ',', '.');
     }
     function escasql($text)
     {
         $text = preg_replace("/\r\n+|\r+|\n+|\t+/i", ' ', $text);
         $text = htmlspecialchars($text);
         $text = str_replace(array("'", '"'), array('&#39;', '&quot;'), $text);
         return $text;
     }
     $modulo = $_POST['modulo'];
     $dbmodulo = $this->db->escape($modulo);
     $mFECHA = date('Ymd', timestampFromInputDate($_POST['fecha'], 'd/m/Y'));
     $mTABLA = $this->datasis->dameval("SELECT origen  FROM reglascont WHERE modulo={$dbmodulo} AND regla=1 ");
     $mCONTROL = $this->datasis->dameval("SELECT control FROM reglascont WHERE modulo={$dbmodulo} AND regla=1 ");
     $action = "javascript:window.location='" . site_url("contabilidad/reglas/index/{$mFECHA}") . "'";
     $data['content'] = '';
     $query = $this->db->query("SELECT a.{$mCONTROL} FROM {$mTABLA} WHERE a.fecha={$mFECHA} GROUP BY {$mCONTROL} ");
     foreach ($query->result_array() as $fila) {
         $aregla = $this->_hace_regla($modulo, $mCONTROL, $fila[$mCONTROL]);
         //echo '<pre>';print_r($aregla);'</pre>';
         $encab = $encab_titu = $pivote = array();
         //Construye los encabezados
         foreach ($aregla['casi'] as $mSQL) {
             $casi_query = $this->db->query($mSQL);
             if ($casi_query->num_rows() > 0) {
                 $row = $casi_query->row();
                 $encab[$row->comprob] = array();
                 $encab_titu[$row->comprob] = '<b>Comprobante:</b> ' . $row->comprob . ' <b>Fecha:</b> ' . date('d/m/Y', timestampFromInputDate($row->fecha, 'Y-m-d')) . ' <b>Concepto:</b> ' . $row->concepto;
             }
         }
         //echo $query;
         //Construye la data de los encabezados
         foreach ($aregla['itcasi'] as $mSQL) {
             //echo $mSQL;
             $itcasi_query = $this->db->query($mSQL);
             $acumulador = array(0, 0);
             if ($itcasi_query->num_rows() > 0) {
                 foreach ($itcasi_query->result() as $row) {
                     $pivote['origen'] = $row->clave;
                     $pivote['cuenta'] = $row->cuenta;
                     $pivote['referen'] = $row->referen;
                     $pivote['concepto'] = $row->concepto;
                     $pivote['debe'] = $row->debe;
                     $pivote['haber'] = $row->haber;
                     $pivote['sucursal'] = $row->sucursal;
                     $pivote['ccosto'] = $row->ccosto;
                     $pivote['msql'] = $mSQL;
                     $encab[$row->comprob][] = $pivote;
                     //$acumulador[0]+=$row->debe;
                     //$acumulador[1]+=$row->haber;
                 }
                 $pivote['origen'] = $pivote['cuenta'] = $pivote['referen'] = $pivote['concepto'] = $pivote['sucursal'] = '';
                 $pivote['debe'] = nformat($acumulador[0]);
                 $pivote['haber'] = nformat($acumulador[1]);
                 $pivote['diferencia'] = nformat($acumulador[0] - $acumulador[1]);
                 //$encab[$row->comprob][]=$pivote;
             }
         }
         foreach ($encab as $comprob => $tabla) {
             if (array_key_exists($comprob, $encab_titu)) {
                 $titulo = $encab_titu[$comprob];
             } else {
                 $titulo = 'HUERFANO';
             }
             $grid = new DataGrid2($titulo, $tabla);
             $grid->per_page = count($tabla);
             $grid->use_function('dif', 'escasql');
             //$grid->column('Or&iacute;gen', 'msql');
             $grid->column('Or&iacute;gen', '<span title="<escasql><#msql#></escasql>" onclick="prompt(\'Consulta\',this.title)"><#origen#></span>');
             $grid->column('Cuenta', 'cuenta');
             $grid->column('Referencia', 'referen');
             $grid->column('Concepto', 'concepto');
             $grid->column('Debe', '<nformat><#debe#></nformat>', 'align=\'right\'');
             $grid->column('Haber', '<nformat><#haber#></nformat>', 'align=\'right\'');
             //$grid->column("Diferencia" , "<dif><#debe#>|<#haber#></dif>",'align=right');
             $grid->column('Sucursal', 'sucursal', 'align=\'right\'');
             $grid->column('C. Costo', 'ccosto', 'align=\'right\'');
             $grid->totalizar('debe', 'haber');
             $grid->build();
             //echo $grid->db->last_query();
             $data['content'] .= $grid->output;
         }
     }
     $data['content'] .= HTML::button('regresa', RAPYD_BUTTON_BACK, $action, 'button', 'button');
     $data['head'] = $this->rapyd->get_head();
     $data['title'] = "<h1>Ejecuci&oacute;n de la regla {$modulo}</h1>";
     $this->load->view('view_ventanas', $data);
 }
Exemple #8
0
 function submit($name, $caption, $position = "BL")
 {
     $this->_button_container[$position][] = HTML::button($name, $caption, "", "submit", "button");
 }
Exemple #9
0
<?php

/* @var $this yii\web\View */
use yii\helpers\html;
use yii\helpers\Url;
?>
<h1>Data Base</h1>
<p>
    <a href="<?php 
echo Url::toRoute('zip/get-zip');
?>
">
        <?php 
echo HTML::button('Update data base');
?>
    </a>
</p>
<p>
    <a href="<?php 
echo Url::toRoute('zip/del');
?>
">
        <?php 
echo HTML::button('Clear data base');
?>
    </a>
</p>
Exemple #10
0
 function submit($name, $caption, $position = 'BL')
 {
     $this->_button_container[$position][] = HTML::button($name, $caption, '', 'submit', 'button');
 }
<?php

/* @var $field \allatnet\yii2\modules\extendedrights\components\UserFields */
use yii\helpers\Html;
echo $this->render('/default/_navigation', []);
?>
<h1>Profilfeld anlegen</h1>
<?php 
echo HTML::beginForm(['create']);
?>

<?php 
echo $this->render('_form', ['field' => $field]);
?>

<?php 
echo HTML::button('Speichern', ['type' => 'submit', 'class' => 'btn btn-success']);
echo HTML::endForm();
Exemple #12
0
 function ejecutar()
 {
     $this->rapyd->load("datagrid2", "fields");
     function dif($a, $b)
     {
         return number_format($a - $b, 2, ',', '.');
     }
     $modulo = $_POST['modulo'];
     $mFECHA = date("Ymd", timestampFromInputDate($_POST['fecha'], 'd/m/Y'));
     $mTABLA = $this->datasis->dameval("SELECT origen  FROM reglascont WHERE modulo='{$modulo}' AND regla=1 ");
     $mCONTROL = $this->datasis->dameval("SELECT control FROM reglascont WHERE modulo='{$modulo}' AND regla=1 ");
     $action = "javascript:window.location='" . site_url("contabilidad/reglas/index/{$mFECHA}") . "'";
     $data['content'] = '';
     $query = $this->db->query("SELECT a.{$mCONTROL} FROM {$mTABLA} WHERE a.fecha={$mFECHA} GROUP BY {$mCONTROL} ");
     foreach ($query->result_array() as $fila) {
         $aregla = $this->_hace_regla($modulo, $mCONTROL, $fila[$mCONTROL]);
         //echo '<pre>';print_r($aregla);'</pre>';
         $encab = $encab_titu = $pivote = array();
         //Construye los encabezados
         foreach ($aregla['casi'] as $mSQL) {
             $casi_query = $this->db->query($mSQL);
             if ($casi_query->num_rows() > 0) {
                 $row = $casi_query->row();
                 $encab[$row->comprob] = array();
                 $encab_titu[$row->comprob] = '<b>Comprobante:</b> ' . $row->comprob . ' <b>Fecha:</b> ' . date("d/m/Y", timestampFromInputDate($row->fecha, 'Y-m-d')) . ' <b>Concepto:</b> ' . $row->concepto;
             }
         }
         //echo $query;
         //Construye la data de los encabezados
         foreach ($aregla['itcasi'] as $mSQL) {
             $itcasi_query = $this->db->query($mSQL);
             $acumulador = array(0, 0);
             if ($itcasi_query->num_rows() > 0) {
                 foreach ($itcasi_query->result() as $row) {
                     $pivote['origen'] = $row->clave;
                     $pivote['cuenta'] = $row->cuenta;
                     $pivote['referen'] = $row->referen;
                     $pivote['concepto'] = $row->concepto;
                     $pivote['debe'] = $row->debe;
                     $pivote['haber'] = $row->haber;
                     $pivote['sucursal'] = $row->sucursal;
                     $pivote['ccosto'] = $row->ccosto;
                     $encab[$row->comprob][] = $pivote;
                     //$acumulador[0]+=$row->debe;
                     //$acumulador[1]+=$row->haber;
                 }
                 $pivote['origen'] = $pivote['cuenta'] = $pivote['referen'] = $pivote['concepto'] = $pivote['sucursal'] = '';
                 $pivote['debe'] = number_format($acumulador[0], 2, ',', '.');
                 $pivote['haber'] = number_format($acumulador[1], 2, ',', '.');
                 $pivote['diferencia'] = number_format($acumulador[0] - $acumulador[1], 2, ',', '.');
                 //$encab[$row->comprob][]=$pivote;
             }
         }
         foreach ($encab as $comprob => $tabla) {
             if (array_key_exists($comprob, $encab_titu)) {
                 $titulo = $encab_titu[$comprob];
             } else {
                 $titulo = 'HUERFANO';
             }
             $grid = new DataGrid2($titulo, $tabla);
             $grid->per_page = count($tabla);
             $grid->use_function('dif');
             $grid->column('Or&iacute;gen', 'origen');
             $grid->column('Cuenta', 'cuenta');
             $grid->column('Referencia', 'referen');
             $grid->column('Concepto', 'concepto');
             $grid->column("Debe", "<nformat><#debe#></nformat>", "align=right");
             $grid->column("Haber", "<nformat><#haber#></nformat>", "align=right");
             //$grid->column("Diferencia" , "<dif><#debe#>|<#haber#></dif>",'align=right');
             $grid->column('Sucursal', 'sucursal', 'align=right');
             $grid->column('C. Costo', 'ccosto', 'align=right');
             $grid->totalizar('debe', 'haber');
             $grid->build();
             //echo $grid->db->last_query();
             $data['content'] .= $grid->output;
         }
     }
     $data['content'] .= HTML::button('regresa', RAPYD_BUTTON_BACK, $action, "button", "button");
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = "<h1>Ejecuci&oacute;n de la regla {$modulo}</h1>";
     $this->load->view('view_ventanas', $data);
 }
Exemple #13
0
    function cant($formato = 'pdf')
    {
        if ($formato == 'txt') {
            $tabla = form_open('formatos/descargartxt/' . $this->formato);
        } else {
            $tabla = form_open('forma/ver/' . $this->formato);
        }
        $cbarra = $this->input->post('barras');
        $regresa = HTML::button('btn_regresa', 'Regresar', 'javascript:window.location=\'' . site_url('inventario/etiqueta_sinv/lee_barras') . '\'', 'button', 'button');
        $campos = $nbarras = array();
        if (!empty($cbarra)) {
            $barras = array_unique(explode(',', $cbarra));
            foreach ($barras as $cod) {
                $cod = trim($cod);
                if (empty($cod)) {
                    continue;
                }
                $mSQL_p = 'SELECT codigo FROM sinv';
                $bbus = array('codigo', 'barras', 'alterno');
                $q = consultas::_gconsul($mSQL_p, $cod, $bbus);
                if ($q !== false) {
                    $row = $q->row();
                    $campos[] = $this->db->escape($row->codigo);
                } else {
                    $nbarras[] = $cod;
                }
            }
            if (count($campos) > 0) {
                $campos = implode(',', $campos);
                $consul = "SELECT codigo,barras,descrip,precio1 AS precio, precio2, precio3 ,grupo AS grupoid,pfecha1 AS cfecha, iva FROM sinv WHERE codigo IN ({$campos})";
                $data = array('name' => 'cant', 'id' => 'cant', 'value' => '1', 'maxlength' => '5', 'size' => '5', 'class' => 'inputnum', 'autocomplete' => 'off');
                if (count($nbarras) > 0) {
                    $tabla .= '<p>C&oacute;digos no relacionado con alg&uacute;n producto: ' . implode(',', $nbarras) . '</p>';
                }
                $tabla .= form_hidden('consul', $consul);
                $tabla .= form_label('N&uacute;mero de etiquetas por producto:') . nbs(4);
                $tabla .= form_input($data) . '<br>';
                $tabla .= $regresa;
                $tabla .= form_submit('mysubmit', 'Generar');
                $tabla .= form_close();
            } else {
                $tabla .= heading('Oops! No existen productos con esos c&oacute;digos de barras', 3) . br() . $regresa;
            }
        } else {
            $tabla .= heading('Lo siento, debes ingresar alg&uacute;n c&oacute;digo de barras para poder generar los habladores', 3) . br() . $regresa;
        }
        $data['script'] = '<script type="text/javascript">
		$(function(){
			$(".inputnum").numeric(".");
		});
		</script>';
        $data['title'] = heading('Habladores por c&oacute;digo de barras');
        $data['head'] = script('jquery.js') . script('plugins/jquery.numeric.pack.js');
        $data['content'] = $tabla;
        $this->load->view('view_ventanas', $data);
    }