Beispiel #1
0
print "<table valign=\"center\"  cellspacing=5 width=90% class=saldo>\n";
print "<TR><TD align=right><B>SALDO CAJA POS: </B></TD><TD align=left><b>" . number_format($pago, 2) . "</b></TD></TR>\n";
print "</TABLE>";
?>
<br>
<table width=90% border=1><tr><td><B>VALORES EN CUSTODIA</B></TD></TR></TABLE>
<table border="0" valign="center" width="90%" class="tabla4" cellspacing=0>
<TR class=tablatd><TD>Descripcion</TD>
   <TD ALIGN=CENTER>Anterior</TD>
   <TD ALIGN=CENTER>Ingresos</TD>
   <TD ALIGN=CENTER>Egresos</TD>
   <TD ALIGN=CENTER>Saldo</TD>
</TR>
<?php 
$msql = "SELECT tarjeta, concepto, enlace, saldo, descrip FROM tardet WHERE enlace IS NOT NULL AND enlace!='' GROUP BY enlace";
$menlaces = damecur($msql);
$manterior = 0;
$mingresos = 0;
$megresos = 0;
$msaldos = 0;
for ($count = 1; $row = mysql_fetch_row($menlaces); ++$count) {
    $msql = "SELECT sum(a.total) FROM itdine AS a, dine AS b\n            WHERE a.tipo='{$row['0']}' AND a.concepto='{$row['1']}' AND a.numero=b.numero\n                  AND b.fecha={$qfecha} GROUP BY fecha ";
    $ingreso = dameval($msql);
    $msql = "SELECT sum(a.monto) FROM itbcaj AS a, bcaj AS b\n            WHERE a.tipo='{$row['0']}' AND a.concep='{$row['1']}' AND a.numero=b.numero\n                  AND b.estampa={$qqfecha} GROUP BY fecha ";
    $egreso = dameval($msql);
    print "<tr><td>{$row['4']}</td>";
    print "<td align=right>" . number_format($row[3] - $ingreso + $egreso, 2) . "</td>";
    $manterior += $row[3] - $ingreso + $egreso;
    print "<td align=right>" . number_format($ingreso, 2) . "</td>";
    $mingresos += $ingreso;
    print "<td align=right>" . number_format($egreso, 2) . "</td>";
Beispiel #2
0
 function _ajustainv($mes, $cambia)
 {
     $cambia = str_replace(",", "", $cambia);
     $mSQL = "SELECT sum(minicial), sum(mcompras), sum(mventas), sum(mfinal) FROM invresu WHERE mes={$mes} ";
     $mC = damecur($mSQL);
     $row = mysql_fetch_row($mC);
     $difer = $row[3] - $cambia;
     $factor = ($row[2] + $difer) / $row[2];
     //echo "$cambia  $difer  $factor";
     ejecutasql("UPDATE invresu SET mventas=mventas*" . $factor . " WHERE mes={$mes}");
     saldofinal($mes);
 }
Beispiel #3
0
} else {
    $tasa = 14;
    //traevalor('TASA');
}
@mysql_select_db("{$farma}") or die("No se pudo conectar a {$farma}");
require_once "../wexcel/class.writeexcel_workbook.inc.php";
require_once "../wexcel/class.writeexcel_worksheet.inc.php";
// ARREGLA SIVA PORSIA
$mSQL = "UPDATE siva SET impuesto=0, geneimpu=0, exento=gtotal, stotal=gtotal, general=0 where geneimpu<0 and general>=0 ";
ejecutasql($mSQL);
$mSQL = "UPDATE siva SET geneimpu=0, exento=exento+general, stotal=exento+general, general=0 WHERE geneimpu=0 and general<0  ";
ejecutasql($mSQL);
$mSQL = "\nSELECT \na.fecha AS fecha,\na.numero AS NUMERO,\na.nfiscal AS FINAL,\na.rif AS RIF,\nIF( MID(a.rif,1,1) NOT IN ('J','G') AND b.contacto IS NOT NULL AND b.contacto!='',b.contacto,a.nombre) AS NOMBRE,\nIF(a.tipo='NC',a.numero,'        ') AS NUMNC,\nIF(a.tipo='ND',a.numero,'        ') AS NUMND,\na.tipo AS TIPO, \nIF(a.referen=a.numero,'        ',a.referen) AS AFECTA,\na.gtotal*IF(a.tipo='NC',-1,1) VENTATOTAL,\na.exento*IF(a.tipo='NC',-1,1)  EXENTO,\na.general*IF(a.tipo='NC',-1,1) BASE,\n'{$tasa}%' AS ALICUOTA,\na.impuesto*IF(a.tipo='NC',-1,1) AS Cgimpu,\na.reiva*IF(a.tipo='NC',-1,1),\n'              ' COMPROBANTE,\n'            ' FECHACOMP,\n'            ' IMPERCIBIDO,\n'            ' IMPORTACION,\n'SI' tiva, \na.tipo, \na.numero numa,\na.general,\na.geneimpu,\na.adicional,\na.adicimpu,\na.reducida,\na.reduimpu,\na.contribu c2\nFROM siva a LEFT JOIN scli b ON a.clipro=b.cliente\nWHERE EXTRACT(YEAR_MONTH FROM a.fechal)={$mes} AND a.libro='V' AND a.tipo<>'FA' \nORDER BY a.fecha, IF(a.tipo IN ('FC','XE','XC'),1,2), numa ";
//echo $mSQL;
//die;
$export = damecur($mSQL);
################################################################
#
#  Encabezado
#
$fname = tempnam("/tmp", "lventas.xls");
$wb =& new writeexcel_workbook($fname);
$ws =& $wb->addworksheet($mes);
# ANCHO DE LAS COLUMNAS
$ws->set_column('A:A', 11);
$ws->set_column('B:B', 37);
$ws->set_column('C:C', 11);
$ws->set_column('D:D', 6);
$ws->set_column('E:E', 11);
$ws->set_column('F:F', 6);
$ws->set_column('G:G', 11);