Foros del Web » Programando para Internet » Javascript »

Sera que me pueden colaborar con temas dinamicos

Estas en el tema de Sera que me pueden colaborar con temas dinamicos en el foro de Javascript en Foros del Web. Hola amigos del foro ... tengo el siguiente formulario para capturar informacion: Código PHP: $conn  =  conectar ();  // Llama a la funcion de conexion a la BD            $sql1  = ( "select c.idcont from contabilizacion c where c.idcont <> null or c.idcont = null or c.idcont > 0" );          $respu1  ...
  #1 (permalink)  
Antiguo 23/09/2005, 14:25
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
Sera que me pueden colaborar con temas dinamicos

Hola amigos del foro ... tengo el siguiente formulario para capturar informacion:

Código PHP:
$conn conectar(); // Llama a la funcion de conexion a la BD 
         
$sql1 = ("select c.idcont from contabilizacion c where c.idcont <> null or c.idcont = null or c.idcont > 0");         

$respu1 mysql_query($sql1); 
$res1 mysql_num_rows($respu1); 

if(
$res1 == 0){ 

$sql1 "insert into contabilizacion (idcont, numdoc, codcuenta, nitcontab, indcucontab, debito, credito, vrbase, detacontab, naturaleza) values ('$idcont', '$numdoc', '$codcuenta', '$nitcontab', '$indcucontab', '$debito', '$credito', '$vrbase', '$detacontab', '$naturaleza')"
$respu1 mysql_query($sql1); 


Esta es la Tabla:

CREATE TABLE contabilizacion
(
idcont int NOT NULL AUTO_INCREMENT,
numdoc varchar(5) NOT NULL,
codcuenta varchar(8) NOT NULL,
nitcontab varchar(11) NOT NULL,
indcucontab varchar(2) NOT NULL,
debito double,
credito double,
detacontab text,
vrbase double,
naturaleza char(1),
PRIMARY KEY (idcont),
INDEX (numdoc),
FOREIGN KEY (numdoc) REFERENCES documento(numdoc) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (codcuenta),
FOREIGN KEY (codcuenta) REFERENCES cuentas(codcuenta) ON UPDATE CASCADE ON DELETE CASCADE
) TYPE = INNODB;



Necesito que este formulario sea dinamico, osea que en mi pagina exista un boton que se llame agregar
que me permita adicionar varios formularios en mi pagina y al final haya un boton aceptar que inserte
todos los item en mi BD.


El codigo de ayuda es el siguiente ... pero la verdad estoy un poco confundido.

Código PHP:
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 

<script language="javascript"> 

data="<input type='text' name='numdoc[]' id='numdoc' class='txtBoxStyle' size='10'><a hre='#' onClick='DeleteRow(this)'> <img src='SIGDOC/ICONOS/SUBMIT.GIF' border='0'></a><input type='radio' name='cierto' id='cierto'>"; 

function AddRowsToTable(code) //no necesario pero en caso de que quieras agregar otra cosa 

    var tbl = document.getElementById('tblSample'); 
    var lastRow = tbl.rows.length; 
    var row = tbl.insertRow(lastRow); 
    var cellRight = row.insertCell(0); 
    cellRight.innerHTML=code; 


function DeleteRow(x) 

    while (x.tagName.toLowerCase() !='tr') 
    { 
        if(x.parentElement) 
            x=x.parentElement; 
        else if(x.parentNode) 
            x=x.parentNode; 
        else 
    return; 
    } 

    var rowNum=x.rowIndex; 

    while (x.tagName.toLowerCase() !='table') 
    { 
    if(x.parentElement) 
        x=x.parentElement; 
    else if(x.parentNode) 
        x=x.parentNode; 
    else 
    return; 
    } 
    x.deleteRow(rowNum); 


function RemoveRowFromTable(rowid) { 
    //alert("sadfs"); 
    var tbl = document.getElementById(iteration); 
        //var lastRow = tbl.rows.length; 
        //if (lastRow > 1) 
        tbl.deleteRow(rowid); 



function este() 
{
    elem=document.all?document.all.numdoc:document.getElementById('numdoc');
        
    if(elem.length){
        elem[elem.length-1].focus();
    }else{
        elem.focus();
    }
}
</script> 

</head> 

<body> 
<form id="formulario" name="formulario" method="post" action="<?=$_SERVER['PHP_SELF']?>"> 
<table cellpadding="0" cellspacing="0" width="304" border="0"> 
    <tr> 
        <td> 
        Respuestas:&nbsp;<input name="button" type="button" onClick="AddRowsToTable(data);este();return false;" value="+" class="Buttonforms"></td> 
         
        </td> 
    </tr> 
    <tr> 
        <td> 
            <table cellpadding="1" cellspacing="0" width="100%" id="tblSample" border="0"> 
            </table> 
        </td> 
    </tr> 
    <tr> 
        <td> 
        <hr> 
        <input type="submit"> 
        </td> 
    </tr> 
</table> 
<hr> 

<?php 
//obtener valores de numdoc 
$numdoc=isset($_POST['numdoc'])?$_POST['numdoc']:array(); 

//answers 
echo('<b>Valores de numdoc[]</b>:<br>'); 
foreach(
$numdoc as $ans){ 
    echo(
$ans.' <br>'); 

?> 
</form> 
</body> 
</html>

Como lo convierto a dinamico? ... como lo haria ahora ???? ** teniendo presente que ahora no solo voy a insertar un item sino todos los que vaya agregando ..... hasta N.

Gracias por tu colaboracion;
  #2 (permalink)  
Antiguo 23/09/2005, 14:53
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
mira mano no entiendo muy bien lo q quieres

en el codigo 2do
se puede agregar filas(registros) a tu formulario mas q eso tr td input a tu tabla
pero dime
quieres q con un boton puedas agregar formularios a tu pagina y q estos a la vez puedas agregar input text en su contenido y tambien quieres q se pueda quitar formularios de tu pagina?
  #3 (permalink)  
Antiguo 23/09/2005, 14:54
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
De acuerdo Oye me entendiste .... Claro mi hermano

Gracias ... tu si entiendes.
  #4 (permalink)  
Antiguo 23/09/2005, 14:59
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
ok, bueno creo q hice algo de eso dejame buscarlo o sino hacerlo
bueno al menos intentare

si lo logras antes q yo pasa la voz para dejar de hacerlo
  #5 (permalink)  
Antiguo 23/09/2005, 15:07
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
De acuerdo Ok mi hermano .. gracias

Ok .....

:-d
  #6 (permalink)  
Antiguo 23/09/2005, 15:54
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
mira nose si esto es lo q quieres pero chequealo

<html><head>
<script language="JavaScript">
var i=1;
var reto;
function A()
{
var t=document.getElementById('cont').innerHTML;
//t=t.substring(0,(t.length-8));
reto = "table_" ;
//t+="<tr><td><input type='text' value="+i+">"+i+",1</td><td>"+i+",2</td><td>"+i+",3</td><tr></table>";
t+="<table border='1'>";
t+="<form id='fomr" +i+ "'>";
t+="<tr><td>";
t+="<input name='button" +i+ "' type='button' onClick='AddRowsToTable(data,"+i+");return false;' value='+'>";
t+="<table border=1 id='table_" +i+ "'></table>";
t+="</td></tr></form>";
t+="</table>";

document.getElementById('cont').innerHTML=t;
i++;
}
var data = "<input type='text' name='numdoc[]' id='numdoc' class='txtBoxStyle' size='10'><a hre='#' onClick='DeleteRow(this)'> <img src='SIGDOC/ICONOS/SUBMIT.GIF' border='0'></a><input type='radio' name='cierto' id='cierto'>";

function AddRowsToTable(code,n) //no necesario pero en caso de que quieras agregar otra cosa
{
var tbl = document.getElementById('table_'+n);
var lastRow = tbl.rows.length;
var row = tbl.insertRow(lastRow);
var cellRight = row.insertCell(0);
cellRight.innerHTML=code;
//alert(code);
//alert(n);
}

function DeleteRow(x)
{
while (x.tagName.toLowerCase() !='tr')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}

var rowNum=x.rowIndex;

while (x.tagName.toLowerCase() !='table')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}
x.deleteRow(rowNum);
}

function RemoveRowFromTable(rowid) {
//alert("sadfs");
var tbl = document.getElementById(iteration);
//var lastRow = tbl.rows.length;
//if (lastRow > 1)
tbl.deleteRow(rowid);
}


function este()
{
elem=document.all?document.all.numdoc:document.get ElementById('numdoc');

if(elem.length){
elem[elem.length-1].focus();
}else{
elem.focus();
}
}
</script></head><body>
<input type="button" name="af" value="Añadir Form" onClick="A();">
<div id="cont">
</div>
</body></html>

bueno suerte nos vemos
  #7 (permalink)  
Antiguo 23/09/2005, 16:15
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
De acuerdo No ....

Oye esta muy bonito pero ... la idea es que cuando agrego un form este me carge todos los campos del formulario y luego me permita agregarlo atravez de un boton a la base de datos.

Cuales campos: Pues los de mi BD

CREATE TABLE contabilizacion
(
idcont int NOT NULL AUTO_INCREMENT,
numdoc varchar(5) NOT NULL,
codcuenta varchar(8) NOT NULL,
nitcontab varchar(11) NOT NULL,
indcucontab varchar(2) NOT NULL,
debito double,
credito double,
detacontab text,
vrbase double,
naturaleza char(1),
PRIMARY KEY (idcont),
INDEX (numdoc),
FOREIGN KEY (numdoc) REFERENCES documento(numdoc) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (codcuenta),
FOREIGN KEY (codcuenta) REFERENCES cuentas(codcuenta) ON UPDATE CASCADE ON DELETE CASCADE
) TYPE = INNODB;

Que tal .... ??
  #8 (permalink)  
Antiguo 23/09/2005, 16:29
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
mano respondeme esto:
por q quieres q sean varios formularios?
y

creo lo q quieres es poder insertar N registros a tu tabla contabilizacion

y cuando me refiero a N
==> seria la cantidad de veces q el usuario pulso agregar(y cuando pulsa agregar inserta la cantidad de campos de tu tabla)

bueno sino es asi explicame un poco mejor para q querer tal cosa?
  #9 (permalink)  
Antiguo 23/09/2005, 16:48
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
Ahi va mi hermano

Resulta que tengo un comprobante de egreso en el cual debo contabilizar varias cuentas

Tengo estas tablas:

CREATE TABLE documento
(
numdoc varchar(5) NOT NULL,
tipo char(2) NOT NULL,
planilla char(2) NOT NULL,
anolapso char(2),
meslapso char(2),
nit varchar(11) NOT NULL,
indcu varchar(2) NOT NULL,
anodoc char(2),
mesdoc char(2),
diadoc char(2),
vrdoc double,
detadoc text,
descripuser varchar(15) NOT NULL,
PRIMARY KEY (numdoc),
INDEX (indcu),
FOREIGN KEY (indcu) REFERENCES cu(indcu) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (nit),
FOREIGN KEY (nit) REFERENCES beneficiario(nit) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (tipo,planilla),
FOREIGN KEY (tipo,planilla) REFERENCES tipodocum(tipo,planilla) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (descripuser),
FOREIGN KEY (descripuser) REFERENCES usuario(descripuser) ON UPDATE CASCADE ON DELETE CASCADE
) TYPE = INNODB;

-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla contabilizacion
--

CREATE TABLE contabilizacion
(
idcont int NOT NULL AUTO_INCREMENT,
numdoc varchar(5) NOT NULL,
codcuenta varchar(8) NOT NULL,
nitcontab varchar(11) NOT NULL,
indcucontab varchar(2) NOT NULL,
debito double,
credito double,
detacontab text,
vrbase double,
naturaleza char(1),
PRIMARY KEY (idcont),
INDEX (numdoc),
FOREIGN KEY (numdoc) REFERENCES documento(numdoc) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (codcuenta),
FOREIGN KEY (codcuenta) REFERENCES cuentas(codcuenta) ON UPDATE CASCADE ON DELETE CASCADE
) TYPE = INNODB;

******** La tabla contabilizacion esta sujeta al comprobante.
Dicho comprobante puede tener varias contabilizaciones y es ahi donde quiero agregar los campos dinamicos .... tener un boton que me permita agregar los campos de mi tabla contabilizacion.

Ejemplo:

Un comprobante puede tener contabilizado:

1. Idcont (01 este se auto incrementa) - numdoc (01) - codcuenta (10 Caja) - nitcontab (nit) ... etc

Pero debe tener cuentas de contrapartida

2. Idcont (02 este se auto incrementa) - numdoc (01) - codcuenta (11 Bancos) - nitcontab (nit) ... etc

3. Idcont (03 este se auto incrementa) - numdoc (01) - codcuenta (15 cuentas por cobrar) - nitcontab (nit) ... etc

... etc es un ejemplo las cuentas son inventadas.

Ahora cuando temine de llenar las cuantas me debe permitir insertar todos los item en la tabla.

... Que tal?

  #10 (permalink)  
Antiguo 23/09/2005, 17:12
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
mira mano
dime si algo como esto
http://fastboss.com (en español)

haz click en view demo ingresa

luego haz click en 2do tab de la izquierda luego la opcion clientes
y escoje un cliente y luego agrega un factura si es algo como eso te puedo ayudar?

bueno suerte
  #11 (permalink)  
Antiguo 23/09/2005, 17:20
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
De acuerdo Si ... asi es ...

Asi es ... gracias mi hermano ....

... estaria totalmente agradecido.
  #12 (permalink)  
Antiguo 23/09/2005, 17:46
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
bueno te paso el codigo tienes q chequearlo bien ya q hace referencia a otra base de datos espero q lo entiendas bue ahi te va
son tres paginas pero tienes q depurar ya q esto esta sin borrar funciones q no son usadas bueno aca ay arto trabajo:
  #13 (permalink)  
Antiguo 23/09/2005, 17:47
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
//slice_sm_6_4.php
<?php
require('slice_methods_6.php');

$num_igual="";

if(isset($_SESSION['invoice_id']))
{
$cq="select * from client_prop_inv where client_invoice_id={$_SESSION['invoice_id']}";
$ra=mysql_query($cq) or die("ERROR EN PROPOSAL_VAR ".mysql_error().$cq);
$ws=mysql_fetch_array($ra);
if($ws['numero']!="") {
$guion = "-".$ws['numero'];
}
}
//
if( $_SESSION['prop_invoice']!="" and $nadd==0 or $nadd=="" and $_SESSION['prop_invoice']!="" )
{
$var_S = explode(PARSER,$_SESSION['prop_invoice']);
$id_1_pro = $var_S[0];
$id_2_num = $var_S[1];
////////////////////////////////
$cq="select * from client_prop_inv where client_proposal_id=".$id_1_pro." ";
$ra=mysql_query($cq) or die("ERROR EN PROPOSAL_VAR ".mysql_error().$cq);
if(mysql_num_rows($ra)!=0)//2 o 1 0 3
{
$ws=mysql_fetch_array($ra);
$_id_cii = $ws['client_invoice_id'];
$ca="select nro from client_invoice where id =".$_id_cii." and estatus ='E'";
$ro=mysql_query($ca) or die("ERROR AL SELECCIONAR INVOICE".mysql_error().$ca);
$fs=mysql_fetch_array($ro);
$num_igual = $fs['nro'];
}
/////////////////////////////////
$consul="select * from client_prop_inv where client_proposal_id=".$id_1_pro." and numero=".$id_2_num."";
$resulta=mysql_query($consul) or die("ERROR EN PROPOSAL_VAR ".mysql_error().$consul);
if(mysql_num_rows($resulta)!=0)
{
$rows=mysql_fetch_array($resulta);
$consulta="select * from client_invoice where id =".$rows['client_invoice_id']." and estatus ='E'";
$resultado=mysql_query($consulta) or die("ERROR AL SELECCIONAR CLIENT_PROPOSAL".mysql_error().$consulta);
$filas=mysql_fetch_array($resultado);
$_SESSION['invoice_id']=$filas['id'];
}
$guion = "-".$id_2_num;
}
////////////////////////////////////////////////////////////////////////////////
$ver_data=false;
//---------------Cambios al Submitar sobre esta misma pagina
$query="select items.id,items.nombre from items,item_profile where items.id =item_profile.items_id and slices_id =".$_SESSION['slices_id'];
$result=mysql_query($query);
//$_SESSION['clients_id'];
if(!isset($fase))
{
$qy = "select max(nro + 1) as idmax from client_invoice";
$rt=mysql_query($qy);
$rw=mysql_fetch_array($rt);
}

if($_SESSION['invoice_id']!=''){
$que2="select * from client_invoice where id=".$_SESSION['invoice_id'];
$res2=mysql_query($que2)or die("error al seleccionar".mysql_error());
$fil2=mysql_fetch_array($res2);
$addr = explode(PARSER,$fil2['direccion']);
$_inv["addr1"] = $addr[0];
$_inv["addr2"] = $addr[1];
$_inv["date1"] = date("m/d/y",strtotime($fil2["sdate"]));
$_inv["date2"] = date("m/d/y",strtotime($fil2["kdate"]));
}
//////////////////////////////////////////////////////////////////////////////////////
if($_SESSION['invoice_id']!='')
{
if($num_igual==''){
$num_igual=$fil2['nro'];
}
}else{
if($num_igual==''){
if($rw['idmax']=='' or $rw['idmax']==0){$rw['idmax']=1;}
$num_igual = formato_num($rw['idmax']);
}
}
// enviar datos a la pagina de invoice
if($_SESSION['invoice_id']==''){
$qr_i="SELECT * FROM client_profile WHERE slices_id=".$_SESSION['slices_id']." and clients_id=".$_SESSION['clients_id'];
$rs_i = mysql_query($qr_i) or die("<strong>lectura de clients profile<pre>".mysql_error()."</pre></strong>");
$row_i = mysql_fetch_array($rs_i, MYSQL_ASSOC);
$dir_i = explode(PARSER,$row_i['address']);
}
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function close_invoice()
{
document.getElementById('dat_send').name="cambia_c lient_estado";
document.getElementById('dat_send').value = <?php if(isset($_SESSION['prop_invoice'])and($_SESSION['prop_invoice']!="")){ echo "3";} else { echo "1";}?>;
mayopi_carga('send_data','self');
}
function refresca()
{
document.location.href="<?php echo HOME_DIR;?>";
// mayopi_carga('send_data','self');
}
//agregar items al iframe(como)
function add_items()
{
var sip;
sip = document.getElementById('si').value;
if(sip=="ALL")
{
//en caso dse que no selecccione nada
alert('<?php echo MSG_6_43;?>');
}else if(sip=="00"){
//en caso de seleccione other
invo_6.document.getElementById('id_v').value='all' ;
invo_6.submita_add();
}else{
//en caso de seleccione un items
id_i = document.getElementById('si').value;
invo_6.document.getElementById('id_v').value=id_i;
//en caso de q sea add
var w=true;

//alert(xxxx);
//en caso de q sea leido
xxxxx = invo_6.document.getElementById('items_cod').value;
if(xxxxx!='')
{
for(i=1;i<xxxxx;i++)
{
if(invo_6.document.getElementById('id_i'+i).value= =id_i)
{
//alert("hay igual a ti");
invo_6.document.getElementById('q'+i).value=parseF loat(invo_6.document.getElementById('q'+i).value) + 1;
invo_6.document.getElementById('q'+i).focus();
invo_6.subtotal();
w=false;
break;
}
}
}
xxxx = invo_6.document.getElementById('items_cod1').value ;

if((xxxx!='') && (w==true))
{
for(i=1;i<xxxx;i++)
{
if(invo_6.document.getElementById('id_i'+i).value= =id_i)
{
//alert(" aca ta,mbiuehay igual a ti");
invo_6.document.getElementById('q'+i).value=parseF loat(invo_6.document.getElementById('q'+i).value) + 1;
invo_6.document.getElementById('q'+i).focus();
invo_6.subtotal();
w=false;
break;
}
}
}
if(w){
invo_6.submita_add();
}
}
}
//************************************************** ***//
function copy_inv()
{
if(confirm("<?php echo MSG_6_109;?>"))
{
document.getElementById('dat_send').name="action_i ";
document.getElementById('dat_send').value = "copy";
mayopi_carga('send_data','self');
}
}
//************************************************** ****//
<?php if(isset($_SESSION['invoice_id'])) {?>
function borra_invoice()
{
if(confirm('<?php echo MSG_6_65;?>'))
{
document.getElementById('dat_send').name="action_i ";
document.getElementById('dat_send').value = "delete";
mayopi_carga('send_data','self');
}
}

function fPdfInvoice(n)
{
switch(n)
{
case 1: //E-mail PopUp
var Tp = findPosY(document.getElementById('xx0'))+50;
var Lp = findPosX(document.getElementById('xx0'))+250;
iPopUp("index.php?page_code=600&facid=<?php echo $_SESSION['invoice_id'];?>&type=invoice",290,222,Lp,Tp);
break;
case 2: // Download File
bajar_pdf.location.href="pdf_invoice.php?facid=<?p hp echo $_SESSION['invoice_id'];?>";
break;
}
}
<?php }?>
//-->
</SCRIPT>
<form id="data_profile">
<table cellpadding="0" cellspacing="0" border="0" width="637">
<tr>
<td width="1" bgcolor="#ffffff"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td width="635" colspan="3" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td> <td width="1" bgcolor="#ffffff"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td rowspan="3" width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td bgcolor="#FF7C80" colspan="2"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td bgcolor="#FF7C80" rowspan="3" align="left" valign="middle"><?if($_SESSION['invoice_id']!=''){?><img src="images/copy.gif" alt="" width="16" height="16" border="0" title="<?php echo MSG_6_108;?>" onclick="copy_inv();" style="cursor:pointer;"><?}?></td>
<td rowspan="3" width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#FF7C80" colspan="2"><img src="images/nothing.gif" width="610" height="2" border="0"></td>
</tr>
<tr>
<td valign="top" align="left" bgcolor="#FF7C80" class="b12" style="color:white;"><img src="images/nothing.gif" width="9" height="1" border="0"><strong><?php echo MSG_6_66;?></strong></td>
<td valign="top" align="right" bgcolor="#FF7C80" class="b12" style="color:white;"><table cellpadding="0" cellspacing="0" border="0"><tr><td><input readonly="true" type="Text" name="id_num" id="id_num" class="b12" style="background-color:#FF7C80;border:0;color:white;text-align:right;" value="<?echo $num_igual;?>"></td><td bgcolor="#FF7C80" class="b12" style="color:white;font-size:13px;"><?echo $guion;?>&nbsp;&nbsp;</td></tr></table></td>
</tr>
<tr>
<td bgcolor="#999999" colspan="5"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td colspan="5">
<table cellpadding="0" cellspacing="0" border="0" width="637">
<tr>
<td width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td width="635" bgcolor="#ffffff" height="335" valign="top">
<!---- Tabla de Data del proposal client
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff">
  #14 (permalink)  
Antiguo 23/09/2005, 17:48
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
<input type="Hidden" name="id_pas" id="id_pas">
<input type="Hidden" name="action_i" id="action_i">
<input type="Hidden" name="save_update_proposal_id" value="<?php echo $row2['id'];?>">
<tr>
<td><img src="images/nothing.gif" width="5" height="1" border="0"></td>
<td valign="top">
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" width="200">
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td class="b12"><?php echo MSG_6_67;?></td>
</tr>
<tr>
<td><input type="Text" class="n11" id="invoice_name" name="invoice_name" maxlength="40" style="width:200;" value="<?php echo $fil2['name'];?>"></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="10" border="0"></td>
</tr>
<tr>
<td class="b12"><?php echo MSG_6_68;?></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td class="b10"><?php echo MSG_6_69;?></td>
</tr>
<tr>
<td><input type="Text" class="n11" name="invoice_addr1" id="invoice_addr1" maxlength="40" style="width:200;" value="<?php echo $_inv["addr1"];?>"></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td class="b10"><?php echo MSG_6_70;?></td>
</tr>
<tr>
<td><input type="Text" class="n11" name="invoice_addr2" id="invoice_addr2" maxlength="50" style="width:200;" value="<?php echo $_inv["addr2"];?>"></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="10" border="0"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="b10"><?php echo MSG_6_71;?></td>
<td align="center" class="b10"><?php echo MSG_6_72;?></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="1" height="3" border="0"></td>
</tr>
<tr>
<td align="center"><img class="mano" src="images/icon_calendar.gif" onclick="gfPop.fPopCalendar(document.getElementByI d('startdate'));" width="16" height="16" border="0"></td>
<td align="center"><img class="mano" src="images/icon_calendar.gif" onclick="gfPop.fPopCalendar(document.getElementByI d('enddate'));" width="16" height="16" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="1" height="3" border="0"></td>
</tr>
<tr>
<td align="center"><input id="startdate" readonly="true" type="Text" class="n11" name="invoice_date1" maxlength="10" style="width:80;text-align:center;" value="<?php echo $_inv["date1"]?>"></td>
<td align="center"><input id="enddate" readonly="true" type="Text" class="n11" name="invoice_date2" maxlength="10" style="width:80;text-align:center;" value="<?php echo $_inv["date2"]?>"></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="15" border="0"></td>
</tr>
<tr>
<td align="center"><?if($_SESSION['invoice_id']!=''){?><img src="<?php echo $_SESSION['language'];?>images/btn_email1.gif" width="100" height="20" border="0" class="mano" onclick="fPdfInvoice(1);"><?}else{?><img src="images/nothing.gif" width="100" height="20" border="0"><?}?></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td align="center"><?if($_SESSION['invoice_id']!=''){?><img src="<?php echo $_SESSION['language'];?>images/btn_download1.gif" width="100" height="20" border="0" class="mano" onclick="fPdfInvoice(2);"><?}else{?><img src="images/nothing.gif" width="100" height="20" border="0"><?}?></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td align="center"><img class="mano" src="<?php echo $_SESSION['language'];?>images/btn_sav_upd1.gif" width="100" height="20" style="cursor:pointer;" border="0" onclick="invo_6.save_id();"></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td align="center"><?if($_SESSION['invoice_id']!=''){?><img src="<?php echo $_SESSION['language'];?>images/btn_del1.gif" width="100" height="20" border="0" class="mano" onclick="borra_invoice();"><?}else{?><img src="images/nothing.gif" width="100" height="0" border="0"><?}?></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td align="center"><img src="<?php echo $_SESSION['language'];?>images/btn_back1.gif" alt="" width="100" height="20" border="0" onclick="close_invoice()" style="cursor:pointer;"></td>
</tr>
<tr>
<td><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
</table>
</td>
<td><img src="images/nothing.gif" width="10" height="1" border="0"></td>
<td valign="top" width="415" height="200">
<table cellpadding="0" cellspacing="0" width="415">
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>
<tr>
<td colspan="2">
<table id="davidmalo" cellpadding="0" cellspacing="0" width="392" border="1">
<tr>
<td class="b10" width="248">
<table cellpadding="0" cellspacing="0" >
<tr>
<td colspan="3" height="3"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<!--td class="b10">&nbsp;<?php echo MSG_6_73;?>&nbsp;</td-->
<td colspan="2">&nbsp;<select class="b10" style="width:205px;" name="si" id="si">
<option value="ALL">--- <?php echo MSG_6_74;?> ---
<?while($row=mysql_fetch_array($result)){?>
<option value="<?echo $row["id"];?>"><?if($row["nombre"]==""){echo "ID - ".$row["nro_unico"];}else{echo $row["nombre"];}?>
<?}?>
<option value="00"><?php echo MSG_6_75;?>
</select>&nbsp;<!--input style="width:10px;" type="Button" value="-" onclick="invo_6.submita_resta()"--> </td>
<td><img src="images/mas.jpg" alt="" width="20" height="20" border="0" onclick="add_items();" style="cursor:pointer;">&nbsp;</td>
</tr>
</table>
</td>
<td class="b10" width="35" align="center"><?php echo MSG_6_76;?></td>
<td class="b10" width="50" align="center"><?php echo MSG_6_77;?></td>
<td class="b10" width="50" align="center"><?php echo MSG_6_78;?></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"><iframe name="invo_6" id="invo_6" src="index.php?page_code=67" frameborder="0" width="410" height="145"></iframe></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>
<tr>
<td class="b10" colspan="2"><?php echo MSG_6_79;?></td>
</tr>
<tr>
<td colspan="1"><textarea class="b10" name="desc" id="desc" style="font-weight:normal;width:240px;height:125px;"><?echo $fil2["descri"];?></textarea></td>
<td>
<table cellpadding="0" cellspacing="0" width="170" border="0">
<tr>
<td class="b10" align="right" width="70"><?php echo MSG_6_80;?>&nbsp;</td>
<td class="b10" align="center" width="100" style="font-weight:normal;" valign="bottom"><?php echo $_currency["{$_SESSION['fb_currency']}"]["cur"];?> <input class="b10" type="Text" name="sub_total" id="sub_total" value="<?echo number_format(($fil2["subtotal"]+0),2,".","");?>" style="font-weight:normal;width:80px;" readonly="true"></td>
</tr>
  #15 (permalink)  
Antiguo 23/09/2005, 17:49
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
<tr>
<td colspan="2" bgcolor="#000000" align="center"><img src="images/nothing.gif" width="160" height="1" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>

<tr>
<td class="b10" align="right" width="70"><?php echo MSG_6_81;?>&nbsp;</td>
<td class="b10" align="left" width="100" style="font-weight:normal;">&nbsp;&nbsp;&nbsp;<img src="images/nothing.gif" width="3" height="6" border="0"><input type="Text" style="width:30px;height:17px;" class="b10" style="font-weight:normal;" name="dis" id="dis" value="<?echo ($fil2["descuento"]+0);?>" onkeyup="invo_6.subtotal();" onkeypress="invo_6.subtotal();">%</td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000" align="center"><img src="images/nothing.gif" width="160" height="1" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>

<tr>
<td class="b10" align="right" width="70"><?php echo MSG_6_82;?>&nbsp;</td>
<td class="b10" align="center" width="100" style="font-weight:normal;"><?php echo $_currency["{$_SESSION['fb_currency']}"]["cur"];?> <input type="Text" readonly="true" style="width:80px;height:17px;" class="b10" style="font-weight:normal;" name="nt" id="nt" value="<?echo number_format(($fil2["newtotal"]+0),2,".","");?>"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000" align="center"><img src="images/nothing.gif" width="160" height="1" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>

<tr>
<td class="b10" align="right" width="70"><input type="Text" style="width:22px;height:17px;" class="b10" style="font-weight:normal;" value="<?echo ($fil2["tax"]+ 0 );?>" name="tax1" id="tax1" onkeyup="invo_6.subtotal();" onkeypress="invo_6.subtotal();"> % <?php echo MSG_6_83;?>&nbsp;</td>
<td class="b10" align="center" width="100" style="font-weight:normal;"><?php echo $_currency["{$_SESSION['fb_currency']}"]["cur"];?> <input readonly="true" type="Text" style="width:80px;height:17px;font-weight:normal;" class="b10" value="<?echo number_format(($fil2["taxmount"]+0 ),2,".","");?>" name="tax2" id="tax2"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000" align="center"><img src="images/nothing.gif" width="160" height="1" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="images/nothing.gif" width="5" height="6" border="0"></td>
</tr>
<tr>
<td width="70" class="b10" style="font-weight:normal;" align="center"><?php echo MSG_6_84;?></td>
<td class="b10" width="100">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input readonly="true" type="Text" style="width:80px;height:17px;" class="invoice_1" id="tot" name="tot" value="<?echo number_format($fil2["total"],2,".","");?>"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td><img src="images/nothing.gif" width="5" height="1" border="0"></td>
</tr>
</form>
</table>
<!---- FIN Tabla de Data del invoice client
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
</td>
<td width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr><!-- Espacio en blanco del final -->
<td width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td width="635" bgcolor="#ffffff"><img src="images/nothing.gif" width="1" height="20" border="0"></td>
<td width="1" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td width="1" bgcolor="#ffffff"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td width="635" bgcolor="#999999"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
<td width="1" bgcolor="#ffffff"><img src="images/nothing.gif" width="1" height="1" border="0"></td>
</tr>
</table>
</td>
</tr>
</table>
<iframe src="index.php?page_code=9999" width="0" height="0" frameborder="0" scrolling="No" id="bajar_pdf" name="bajar_pdf"></iframe>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
<?if(isset($dir_i)){?>
document.getElementById('invoice_addr1').value = '<? echo $dir_i[0];?>';
document.getElementById('invoice_addr2').value = '<? echo $dir_i[1];?>';
<?}?>
if(document.getElementById("invoice_name").value== '')
{
document.getElementById("invoice_name").focus();
}
//-->
</SCRIPT>
  #16 (permalink)  
Antiguo 23/09/2005, 17:53
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
slice_sm6_dinvoice_67.php

<?php
require_once("valida_apertura_pagina.php");
require_once("db_access.php");
$manda_data=false;
////////////////////producto o servicio///////
function busca_produc($nnn)
{
$query="select * from items where id=".$nnn." and tipo='P' ";
$result=mysql_query($query);
if(mysql_num_rows($result)!=0)//2 o 1 0 3
{
$produc = true;
}else{
$produc = false;
}
return $produc;
}
//en caso de q sea desde el boton negro
function descri_pago($m,&$n,&$w)
{
if($m==1)
{
$title= MSG_6_85;
$money= ($w * 25) / 100;
}else if($m==2){
$title= MSG_6_86;
$money= ($w * 25) / 100;
}else if($m==3) {
$title= MSG_6_87;
$money= ($w * 50) / 100;
}
$w=$money ;
$n=$title;
}
//ELIMINAR ITEMS
if($elimina_i!=0)
{
$que="select items_id from client_detalle_invoice where id=".$elimina_i."";
$res=mysql_query($que);
$ro=mysql_fetch_array($res);
if($ro['items_id']!=0)
{
if(busca_produc($ro['items_id']))
{
// QUERY DE BORRADO
//$qru="delete from item_pedidos where items_id=".$ro['items_id']." and invoice_id=".$_SESSION['invoice_id'];
$qru="UPDATE item_pedidos SET estatus='B' WHERE items_id=".$ro['items_id']." AND invoice_id=".$_SESSION['invoice_id'];
mysql_query($qru)or die("ERROR FATAL BORRAR REGISTROS DE ITEMS PEDIDOS (1)!!!".mysql_error().$qru);
}
}
// QUERY DE BORRADO
//$eli_i="DELETE from client_detalle_invoice where id=".$elimina_i."";
$eli_i="UPDATE client_detalle_invoice SET estatus='B' WHERE id=".$elimina_i;
mysql_query($eli_i);
$ej=true;
}
//////////////////////////////////////////////////////////////////////////////////////////
if($_SESSION['prop_invoice']!="" and $nadd==0 or $nadd=="" and $_SESSION['prop_invoice']!="")
{
$var_S = explode(PARSER,$_SESSION['prop_invoice']);
$id_1_pro = $var_S[0];
$id_2_num = $var_S[1];
$consul="select * from client_prop_inv where client_proposal_id=".$id_1_pro." and numero=".$id_2_num."";
$resulta=mysql_query($consul) or die("ERROR EN PROPOSAL_VAR ".mysql_error().$consul);
if(mysql_num_rows($resulta)==0)
{
$consulta="select * from client_proposal where id =".$id_1_pro." and estatus ='E'";
$resultado=mysql_query($consulta) or die("ERROR AL SELECCIONAR CLIENT_PROPOSAL".mysql_error().$consulta);
$filas=mysql_fetch_array($resultado);
$exp="";
descri_pago($id_2_num,$exp,$filas['cost']);
$s_invoice="add";
$nadd = 1;
$dir = explode(PARSER,$filas['direccion']);
$filas["sdate"] = date("m/d/y",strtotime($filas["sdate"]));
$filas["kdate"] = date("m/d/y",strtotime($filas["kdate"]));
$manda_data=true;
$relation="crea";
}
}
//
$id_pas=false;
$id_pas1=false;
////////////////////////////////////////////////////////////////////////////////////////////////
function tipo_i($inv)
{
if($inv=="P")
{
$a= MSG_6_88;
}else if($inv=="S"){
$a= MSG_6_89;
}
return $a;
}
///////////////////////////////////////////////////
function select_data($y,$x,$b,$c)
{
if($x==1){

$query="select * from items where id=".$y;
$result=mysql_query($query)or die("ERROR EN LA CONSULTA".mysql_error().$query);
while($row=mysql_fetch_array($result))
{
$b=$row['nombre'].tipo_i($row['tipo']);
if($b=='')
{
$b="ID - ".$row['nro_unico'];
}
}
}
else if($x==2)
{
$query="select * from item_profile where items_id=".$y." and slices_id=".$_SESSION['slices_id'];
$result=mysql_query($query)or die("ERROR EN LA CONSULTA".mysql_error().$query);
while($row=mysql_fetch_array($result))
{
if($row['tipo_cobro']=='F')
{
$b=number_format($row['fee'],2,".","");
}else if($row['tipo_cobro']=='H'){
$b=number_format($row['cost'],2,".","");
}else if(($row['tipo_cobro']=='J') or empty($row['tipo_cobro'])) {
$b=number_format($row['retail'],2,".","");
}
//************************************************** ****************************************//
if($b=='')
{
$b="0";
}
}
}
return $b;
}

////////////////////////////////////////////////////////////////////////////////////////////////
function nuevo_row_add($a=1,$A=array(),&$b,&$c,$max,$esc,$w w,$caso3,$caso3_1) {
$numg=$a;
$lista="\r\n";

for($i=0;$i<count($A);$i++)
{
// en caso de q sea un item
if($esc!=""){
if($esc!="all" and $i==($max-1)){$A[$i][4]=select_data($esc,1,'','');}
if($esc!="all" and $i==($max-1)){$A[$i][2]=select_data($esc,2,'','');}
if($esc!="all" and $i==($max-1)){$A[$i][1]="1";}
if($esc!="all" and $i==($max-1)){$A[$i][3]=number_format($A[$i][1] * $A[$i][2],2,".","");}
if($esc!="all" and $i==($max-1)){$A[$i][5]=$esc;}
}
//en caso desde proposal
if($esc=="" and $numg==1){
if($esc=="" and $i==($max-1)){$A[$i][4]=$caso3;}
if($esc=="" and $i==($max-1)){$A[$i][2]=number_format($caso3_1,2,".","");}
if($esc=="" and $i==($max-1)){$A[$i][1]="1";}
if($esc=="" and $i==($max-1)){$A[$i][3]=number_format($A[$i][1] * $A[$i][2],2,".","");}
if($esc=="" and $i==($max-1)){$A[$i][5]=$esc;}
}
//en caso de q sea other
$lista.="<table width=\"392\" cellpadding=\"0\" cellspacing=\"0\" border=\"1\" bgcolor=\"#ffffff\">\r\n";
$lista.="<tr bgcolor=\"#eaeaea\">\r\n";
$lista.=" <input type=\"Hidden\" id=\"id_unic".$numg."\" value=\"\"><input type=\"Hidden\" name=\"idAP".$i."\"><input type=\"Hidden\" name=\"x".$i."[5]\" value=\"".$A[$i][5]."\" id=\"id_i".$numg."\">\r\n";
$lista.=" <td width=\"250\" valign=\"top\"><table cellpadding=\"0\" cellpadding=\"0\" border=\"0\" width=\"15\" height=\"15\"><tr><td valign=\"baseline\"><img src=\"images/delete_icon.gif\" alt=\"[ Delete ]\" width=\"15\" height=\"15\" border=\"0\" style=\"cursor:pointer;\" onclick=\"borra_html(".$numg.",".$i.");\"></td><td><input type=\"Text\" name=\"x".$i."[4]\" value=\"".$A[$i][4]."\" id=\"descript".$numg."\" class=\"n10\" style=\"width:226px;\"></td></tr></table></td>\r\n";
$lista.=" <td width=\"35\"><input name=\"x".$i."[1]\" id=\"q".$numg."\" type=\"Text\" class=\"n10\" style=\"width:35px;\" value=\"".$A[$i][1]."\" onkeyup=\"subtotal()\" onkeypress=\"subtotal()\"></td>\r\n";
$lista.=" <td width=\"50\"><input name=\"x".$i."[2]\" id=\"cost".$numg."\" type=\"Text\" class=\"n10\" style=\"width:50px;\" value=\"".$A[$i][2]."\" onkeyup=\"subtotal()\" onkeypress=\"subtotal()\"></td>\r\n";
$lista.=" <td width=\"50\"><input name=\"x".$i."[3]\" id=\"s_total".$numg."\" readonly=\"true\" class=\"n10\" value=\"".$A[$i][3]."\" style=\"width:50px;\"></td>\r\n";
$lista.="</tr>\r\n";
$lista.="</table>\r\n";
$numg++;
}
$b = $lista;
$c = $numg;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
/////funcion para leer la data
function write_detalle_i(&$x,&$y,&$z,&$rw) {
$lista="\r\n";
$numg=1;
if($_SESSION['invoice_id']!="")
{
$qr = "SELECT * FROM client_detalle_invoice WHERE client_invoice_id = ".$_SESSION['invoice_id'];
$rs = mysql_query($qr) or die("<strong><pre>writePlanStep: ".mysql_error().$qr."</pre></strong>");
$num = mysql_num_rows($rs);
if(mysql_num_rows($rs)!=0) {
while($row=mysql_fetch_array($rs)) {
// en caso de q sea other
$row['costo']=number_format($row['costo'],2,".","");
$row['total']=number_format($row['costo'] * $row['cantidad'],2,".","");
$lista.="<table width=\"392\" cellpadding=\"0\" cellspacing=\"0\" border=\"1\" bgcolor=\"#ffffff\">\r\n";
$lista.="<tr bgcolor=\"#eaeaea\">\r\n";
$lista.=" <input type=\"Hidden\" id=\"id_unic".$numg."\" value=\"".$row['id']."\"><input type=\"Hidden\" value=\"".$row['items_id']."\" id=\"id_i".$numg."\">\r\n";
$lista.=" <td width=\"250\" valign=\"top\"><table cellpadding=\"0\" cellpadding=\"0\" border=\"0\" width=\"15\" height=\"15\"><tr><td valign=\"baseline\"><img src=\"images/delete_icon.gif\" alt=\"[ Delete ]\" width=\"15\" height=\"15\" border=\"0\" style=\"cursor:pointer;\" onclick=\"elimina_item(".$row['id'].");\"></td><td><input type=\"Text\" value=\"".$row['descri']."\" id=\"descript".$numg."\" class=\"n10\" style=\"width:226px;\"></td></tr></table></td>\r\n";
$lista.=" <td width=\"35\"><input id=\"q".$numg."\" type=\"Text\" class=\"n10\" style=\"width:35px;\" value=\"".$row['cantidad']."\" onkeyup=\"subtotal()\" onkeypress=\"subtotal()\"></td>\r\n";
$lista.=" <td width=\"50\"><input id=\"cost".$numg."\" type=\"Text\" class=\"n10\" style=\"width:50px;\" value=\"".$row['costo']."\" onkeyup=\"subtotal()\" onkeypress=\"subtotal()\"></td>\r\n";
$lista.=" <td width=\"50\"><input readonly=\"true\" id=\"s_total".$numg."\" class=\"n10\" value=\"".$row['total']."\" style=\"width:50px;\"></td>\r\n";
$lista.="</tr>\r\n";
$lista.="</table>\r\n";
$numg++;
}
}
}
$x = $lista;
$y = $numg;
$z = $num;
$rw=$numg;
}/////////////////////////////////////////////////////////////////////////////////////////////////
$items_cod="";
write_detalle_i($WPtitle,$numg,$num_1,$items_cod);
/***********************/////////////////////////////////////////////////////////////////////////

if($s_invoice=="add")
{
for($k=0;$k<$nadd;$k++)
{
for($l=1;$l<6;$l++)
{
$trow = "x".$k."[".$l."]";
$ADD[$k][$l] = $$trow;
}
}
nuevo_row_add($numg,$ADD,$newR,$numg,$nadd,$id_v,$ num_1,$exp,$filas['cost']);
$ej = true;
}
  #17 (permalink)  
Antiguo 23/09/2005, 17:54
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
/////////////////////////////////////////////////////////////////////////////////////////////////
//actualizar
if(($s_invoice==="save")and ($_SESSION['invoice_id']!=''))
{
//$my ="DELETE FROM client_detalle_invoice where client_invoice_id = ".$_SESSION['invoice_id']."" ;
//mysql_query($my) or die("ERROR FATAL EN CONSULTA DE ELIMINACION AJAJJAJAJ".mysql_error().$my);
//insertar todos los registrod en la tabla detalle
for($q=1;$q<$numAP;$q++) {
$z ="id_unic".$q; $a = "id_i".$q; $b = "descript".$q; $c = "q".$q; $d = "cost".$q;
if($$a==""){$$a="0";}
if($$z==""){
$query="INSERT INTO client_detalle_invoice (id, fecha, client_invoice_id, items_id, slices_id, clients_id, descri, cantidad, costo, estatus) VALUES (NULL, '".date('Y-m-d')."', ".$_SESSION['invoice_id'].", ".$$a.", ".$_SESSION['slices_id'].", ".$_SESSION['clients_id'].", '".$$b."', ".$$c.", ".$$d.", 'E')";
mysql_query($query)or die("ERROR AL INSERT CON FOR".mysql_error().$query);
if($$a!="" and $$a!="0")
{
if(busca_produc($$a))
{
$qru="INSERT INTO item_pedidos (id, slices_id, items_id, invoice_id,fecha, modo, tipo, title, units, monto, doc_path, estatus) VALUES (NULL, ".$_SESSION['slices_id'].", ".$$a.", ".$_SESSION['invoice_id'].",'".date('Y-m-d')."', 'B', 'Sold', '".$$b."', ".$$c.", ".($$c * $$d).", NULL, 'E')";
mysql_query($qru)or die("ERROR FATAL INSERTAR REGISTROS DE ITEMS (1)!!!".mysql_error().$qru);
}
}
}else{
$query="UPDATE client_detalle_invoice SET fecha= '".date('Y-m-d')."', descri= '".$$b."', costo= ".$$d." ,cantidad =".$$c." WHERE id=".$$z."";
mysql_query($query)or die("ERROR AL INSERT CON FOR".mysql_error().$query);
if($$a!="" and $$a!="0")
{
if(busca_produc($$a))
{
$qru="update item_pedidos set title='".$$b."',units=".$$c." ,monto =".($$c * $$d)." where invoice_id=".$_SESSION['invoice_id']." and items_id=".$$a."";
mysql_query($qru)or die("ERROR FATAL INSERTAR REGISTROS DE ITEMS (2)!!!".mysql_error().$qru);
}
}
}
}
$id_pas1=true;
}
//para grabar un registro
if(($s_invoice==="save") and($_SESSION['invoice_id']=='')) {
//inserta un registro vacio
$micro = md5(microtime()."otracosa");
$query="INSERT INTO client_invoice (id, clients_id, slices_id, nro, fecha, name, direccion, sdate, kdate, descri, subtotal, descuento, newtotal, tax, taxmount,total, estatus) VALUES (NULL,".$_SESSION['clients_id']." , ".$_SESSION['slices_id'].", 0, '-', '".$micro."', '-', '-', '-', '-', 0, 0, 0, 0, 0, 0, 'D')";
$result= mysql_query($query)or die("ERROR EN EL 1er INSERT 1ero".mysql_error().$query);
//seleccion el id del registro anterior
$qu0="SELECT id from client_invoice where name = '".$micro."'";
$r0=mysql_query($qu0)or die("ERROR AL SELECCIONAR ID 2do".mysql_error());
if($row=mysql_fetch_array($r0))
{
$idi__new=$row['id'];
}
//inserta relacion de tablas
if($relation==="crea")
{
$_Q="INSERT INTO client_prop_inv (id, client_proposal_id, client_invoice_id, numero, slices_id, clients_id) VALUES (NULL, ".$id_1_pro.", ".$idi__new.", '".$id_2_num."', ".$_SESSION['slices_id'].", ".$_SESSION['clients_id'].")";
mysql_query($_Q)or die("ERROR EN GRABAR RELATION !!!!!!".mysql_error().$_Q);
}
//insertar todos los registrod en la tabla detalle
for($q=1;$q<$numAP;$q++)
{
$a = "id_i".$q; $b = "descript".$q; $c = "q".$q; $d = "cost".$q;
if($$a==""){$$a="0";}
$query="INSERT INTO client_detalle_invoice (id, fecha, client_invoice_id, items_id, slices_id, clients_id, descri, cantidad, costo, estatus) VALUES (NULL, '".date('Y-m-d')."', ".$idi__new.", ".$$a.", ".$_SESSION['slices_id'].", ".$_SESSION['clients_id'].", '".$$b."', ".$$c.", ".$$d.", 'E')";
mysql_query($query)or die("ERROR AL INSERT CON FOR".mysql_error().$query);
//////////GRABAR ITEMS////////
if($$a!="" and $$a!="0")
{
if(busca_produc($$a))
{
$qru="INSERT INTO item_pedidos (id, slices_id, items_id, invoice_id,fecha, modo, tipo, title, units, monto, doc_path, estatus) VALUES (NULL, ".$_SESSION['slices_id'].", ".$$a.", ".$idi__new.",'".date('Y-m-d')."', 'B', 'Sold', '".$$b."', ".$$c.", ".($$c * $$d).", NULL, 'E')";
mysql_query($qru)or die("ERROR FATAL INSERTAR REGISTROS DE ITEMS (3)!!!".mysql_error().$qru);
}
}
//////////////////////////////////////////
}
$id_pas=true;
}

?>
<html>
<head>
<title>Untitled</title>
<link rel="STYLESHEET" type="text/css" href="styles.css">
<script src="formatnumber.js" type="text/javascript"></script>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
var g = <?php echo $numg;?>
//hallar subtotal de iframe
function elimina_item(id_i)
{
if(confirm('<?php echo MSG_6_90;?>'))
{
document.getElementById("nadd").value = "<?php echo $nadd;?>";
document.getElementById("s_invoice").value = "add";
document.getElementById("elimina_i").value = id_i;
mayopi_carga("fl_i","self");
}
}
function subtotal()
{
var dis;
var validnumber = /(^\d\d*\.\d*$)|(^\d\d*$)|(^\.\d\d*$)/;
var x1=0;
n= <?echo $numg;?>;
for(i=1;i<n;i++)
{
if((validnumber.test(document.getElementById('q'+i +'').value)) && (validnumber.test(document.getElementById('cost'+i +'').value)))
{
mas = parseFloat(document.getElementById('q'+i+'').value ) * parseFloat(document.getElementById('cost'+i+'').va lue);
document.getElementById('s_total'+i+'').value = formatNumber(mas,"0.00");
x1+= ( parseFloat(document.getElementById('s_total'+i+'') .value));
parent.document.getElementById('sub_total').value = formatNumber(x1,"0.00");
dis = parent.document.getElementById('dis').value;
st_d = (parseFloat(parent.document.getElementById('sub_to tal').value) * dis)/100;
parent.document.getElementById('nt').value = formatNumber(parseFloat(parent.document.getElement ById('sub_total').value) - st_d,"0.00");
tax = parent.document.getElementById('tax1').value;
taxp = parseFloat(parent.document.getElementById('nt').va lue * tax) /100;
parent.document.getElementById('tax2').value = formatNumber(taxp,"0.00");
tot = parseFloat(parent.document.getElementById('nt').va lue) + taxp;
parent.document.getElementById('tot').value = formatNumber(tot,"0.00");
}
}
}
////////////////////
//i = id ,
// pos name de donde empieso a poner
function borra_html(i,pos)
{
document.getElementById("id_i"+i).name="";
document.getElementById("descript"+i).name="";
document.getElementById("q"+i).name="";
document.getElementById("cost"+i).name="";
document.getElementById("s_total"+i).name="";
document.getElementById("id_unic"+i).name="";
var ge;
var w=0;
ge =<?echo $numg;?>;
a=pos;
for(z=i;z<ge;z++)
{
w = z +1;
if(w<ge){
document.getElementById("id_i"+w).name="x"+a+"[5]";
document.getElementById("descript"+w).name="x"+a+"[4]";
document.getElementById("q"+w).name="x"+a+"[1]";
document.getElementById("cost"+w).name="x"+a+"[2]";
document.getElementById("s_total"+w).name="x"+a+"[3]";
document.getElementById("id_unic"+w).name="";
a++;
}
}


document.getElementById("nadd").value = "<?php echo $nadd-1;?>";
document.getElementById("s_invoice").value = "add";
mayopi_carga("fl_i","self");

}
////////////////////

function save_id()
{
var a="";
var send = true;
var objRegExp = /^\w+([\s\-]?\w*)*$/i;
var numAp = 0;
/////////////////////// VALIDA INVOICE AND ITEMS ////////////////////////////////
if(parent.document.getElementById("invoice_name"). value=="") {
alert("<?php echo MSG_6_91;?>");
parent.document.getElementById("invoice_name").foc us();
return;
} else if(parent.document.getElementById("invoice_addr1") .value=="") {
alert("<?php echo MSG_6_92;?>");
parent.document.getElementById("invoice_addr1").fo cus();
return;
} else if(parent.document.getElementById("invoice_addr2") .value=="") {
alert("<?php echo MSG_6_92;?>");
parent.document.getElementById("invoice_addr2").fo cus();
return;
} else if(parent.document.getElementById("startdate").val ue=="") {
alert("<?php echo MSG_6_93;?>");
return;
} else if(parent.document.getElementById("enddate").value =="") {
alert("<?php echo MSG_6_94;?>");
return;
} else if(parent.document.getElementById("tot").value==0. 00){
alert("<?php echo MSG_6_95;?>");
return;
}
  #18 (permalink)  
Antiguo 23/09/2005, 17:55
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
for(i=1;i<g;i++) {
if(document.getElementById("descript"+i).value!="" ) {
if((document.getElementById("q"+i).value!="0") && (document.getElementById("q"+i).value!="")){
// if((document.getElementById("cost"+i).value!=0.00) && (document.getElementById("q"+i).value!="")){
document.getElementById("id_i"+i).name="id_i"+i;
document.getElementById("descript"+i).name="descri pt"+i;
document.getElementById("q"+i).name="q"+i;
document.getElementById("cost"+i).name="cost"+i;
document.getElementById("s_total"+i).name="s_total "+i;
document.getElementById("id_i"+i).name="id_i"+i;
document.getElementById("id_unic"+i).name="id_unic "+i;
// }else {
// alert("Type quantity in please");
// return;
}else{
alert("<?php echo MSG_6_96;?>");
send = false;
break;
}
}
}
if(send) {
document.getElementById("s_invoice").value = "save";
document.getElementById("numAP").value = g;
mayopi_carga("fl_i","self");
}
}
<?if($id_pas){?>
parent.document.getElementById('id_pas').value = "<?echo $micro;?>";
parent.document.getElementById('action_i').value = "save";
parent.mayopi_carga('data_profile','self');
<?}?>
<?if($id_pas1){?>
parent.document.getElementById('action_i').value = "update";
parent.mayopi_carga('data_profile','self');
<?}?>
//-->
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bottommargin="0" rightmargin="0">
<form method="post" name="f1_i" id="fl_i">
<input type="Hidden" name="items_cod1" id="items_cod1" value="<?echo $numg;?>">
<input type="Hidden" name="items_cod" id="items_cod" value="<?echo $items_cod;?>">
<input type="Hidden" id="numAP" name="numAP">
<input type="Hidden" name="s_invoice" id="s_invoice">
<input type="Hidden" id="nadd" name="nadd" value="<?echo $nadd;?>">
<input type="hidden" id="id_v" name="id_v" value="<?echo $id_v;?>">
<input type="Hidden" name="propInvoice" id="propInvoice" value="">
<input type="Hidden" name="relation" id="relation" value="<?echo $relation;?>">
<input type="Hidden" name="id_1_pro" id="id_1_pro" value="<?echo $id_1_pro;?>">
<input type="Hidden" name="id_2_num" id="id_2_num" value="<?echo $id_2_num;?>">
<input type="Hidden" name="elimina_i" id="elimina_i" value="0">
<?
echo $WPtitle;
echo $newR;
?>
<!-- -->
</form>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function submita_add(){
document.getElementById("nadd").value = "<?php echo $nadd+1;?>";
document.getElementById("s_invoice").value = "add";
mayopi_carga("fl_i","self");
}
function submita_resta()
{
document.getElementById("nadd").value = "<?php echo $nadd-1;?>";
document.getElementById("s_invoice").value = "add";
mayopi_carga("fl_i","self");
}
<?if($ej){?>
subtotal();
<?}?>
<?if($manda_data==true){?>
parent.document.getElementById("invoice_name").val ue="<?echo $filas['name']?>";
parent.document.getElementById("invoice_addr1").va lue="<?echo $dir[0];?>";
parent.document.getElementById("invoice_addr2").va lue="<?echo $dir[1];?>";
parent.document.getElementById("startdate").value= "<?echo $filas["sdate"];?>";
parent.document.getElementById("enddate").value="< ?echo $filas["kdate"];?>";
<?}?>
//-->
</SCRIPT>
</body>
</html>
  #19 (permalink)  
Antiguo 23/09/2005, 17:56
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
slice_sm_6_4.php

<?php
// Pagina de metodos los slices
//
/******************** SLICE 6 *********************/
$enableHeader = false;
// 6
if(isset($save_update_profile_id))
{
$qr="UPDATE clients SET name='$profile_name' WHERE id=".$_SESSION['clients_id'];
mysql_query($qr) or die("<strong>Update client name<pre>".mysql_error()."</pre></strong>");
if($tipo_pago=='A'){ $pago=$pago_A; }else{ $pago=$pago_B;}
$qr="UPDATE client_profile SET represen='$profile_repre', position='$profile_position', phone='$profile_phone', email='$profile_email', address='".$profile_address.PARSER.$profile_addres s2."', description='".$profile_descrip."', tipo_pago='$tipo_pago', pago='$pago' WHERE id=".$save_update_profile_id;
mysql_query($qr) or die("<strong>Update client_profile<pre>".mysql_error()."</pre></strong>");
// se cambia de estado en el SLICE
//$_SESSION['client_estado']=1;
$_SESSION['mensaje']['txt'] = ADM_SUCCES_SAVED;
$_SESSION['mensaje']['status'] = true;

$enableHeader = true;
}
if(isset($delete_client_profile))
{
// QUERY DE BORRADO
//$qr="DELETE FROM client_profile WHERE id=".$delete_client_profile;
$qr="UPDATE client_profile SET estatus='B' WHERE id=".$delete_client_profile;
mysql_query($qr) or die("<strong>Delete client_profile<pre>".mysql_error()."</pre></strong>");
// Cambiamos de estatus otras relaciones importantes

// Reseteamos algunas variables
$_SESSION['client_estado']=1;
unset($_SESSION['clients_id']);
unset($_SESSION['client_profile_id']);
unset($_SESSION['proposal_id']);
$enableHeader = true;
}
//--------------------------------------------
// GUARDA POR PRIMERA VEZ UN PROPOSAL
if(isset($save_proposal_id))
{
$qr="INSERT into client_proposal (id, clients_id, slices_id, fecha, name, tipo, direccion, sdate, kdate, cost, textcost, stages, especifications, estatus) VALUES (NULL, ".$_SESSION['clients_id'].", ".$_SESSION['slices_id'].", '".date("Y-m-d")."', '$save_proposal_id', '$proposal_type', '".$proposal_addr1.PARSER.$proposal_addr2."', '".date("Y-m-d",strtotime($proposal_date1))."', '".date("Y-m-d",strtotime($proposal_date2))."', '$proposal_cost', '$proposal_textcost', '$proposal_stage', '$proposal_notes', 'E')";
mysql_query($qr) or die("<strong>Crea client_proposal<pre>".mysql_error()."</pre></strong>");
$qr="Select id from client_proposal where name='$save_proposal_id'";
$rs = mysql_query($qr) or die("<strong>Lee id nuevo proposal<pre>".mysql_error()."</pre></strong>");
$row = mysql_fetch_array($rs,MYSQL_ASSOC);
$_SESSION['proposal_id'] = $row['id']; // crea la variable de session que indica el proposal
$qr="UPDATE client_proposal SET name='$proposal_name' where name='$save_proposal_id'";
mysql_query($qr) or die("<strong>Cambia name del nuevo proposal<pre>".mysql_error()."</pre></strong>");
// se cambia de estado en el SLICE
$_SESSION['client_estado']=3;
$_SESSION['mensaje']['txt'] = ADM_SUCCES_SAVED;
$_SESSION['mensaje']['status'] = true;

$enableHeader = true;
}
// UPDATEA UN PROPOSAL
if(isset($update_proposal_id))
{
$qr="UPDATE client_proposal SET fecha='".date("Y-m-d")."', name='$proposal_name', tipo='$proposal_type', direccion='".$proposal_addr1.PARSER.$proposal_addr 2."', sdate='".date("Y-m-d",strtotime($proposal_date1))."', kdate='".date("Y-m-d",strtotime($proposal_date2))."', cost='$proposal_cost', textcost='$proposal_textcost', stages='$proposal_stage', especifications='$proposal_notes' WHERE id=".$update_proposal_id;
mysql_query($qr) or die("<strong>Update client_proposal<pre>".mysql_error()."</pre></strong>");
// se cambia de estado en el SLICE
$_SESSION['client_estado']=3;

$_SESSION['mensaje']['txt'] = ADM_SUCCES_SAVED;
$_SESSION['mensaje']['status'] = true;

$enableHeader = true;
}
// BORRA UN PROPOSAL
if(isset($delete_client_proposal))
{
// QUERY DE BORRADO
//$qr="DELETE FROM client_proposal WHERE id=".$delete_client_proposal;
$qr="UPDATE client_proposal SET estatus='B' WHERE id=".$delete_client_proposal;
mysql_query($qr) or die("<strong>Delete client_proposal<pre>".mysql_error()."</pre></strong>");
// Cambiamos de estatus otras relaciones importantes

// Reseteamos algunas variables
$_SESSION['client_estado']=1;
unset($_SESSION['proposal_id']);
$enableHeader = true;
}
//////////////////////////////////////////////
//para actualizar el invoice
if(($action_i=="update")and($_SESSION['invoice_id']!=''))
{
$invoice_date1 =date('Y-m-d',strtotime($invoice_date1));
$invoice_date2 =date('Y-m-d',strtotime($invoice_date2));
$quer="UPDATE client_invoice SET nro= '".$id_num."', fecha= '".date('Y-m-d')."', name= '".$invoice_name."', direccion= '".$invoice_addr1.PARSER.$invoice_addr2."', sdate= '".$invoice_date1."', kdate= '".$invoice_date2."', descri= '".$desc."', subtotal= ".$sub_total.", descuento= ".$dis.", newtotal= ".$nt.", tax= ".$tax1.", taxmount=".$tax2.", total= ".$tot.", estatus= 'E' WHERE id=".$_SESSION['invoice_id'];
mysql_query($quer) or die('ERROR AL UPDATE EL REGISTRO PRINCIPAL 1 '.mysql_error().$quer);
//update de los nombre de los items en pedidos
$qru="update item_pedidos set title='".$invoice_name."' where invoice_id=".$_SESSION['invoice_id']."";
mysql_query($qru)or die("ERROR FATAL UPDATE REGISTROS DE ITEMS (2.1)!!!".mysql_error().$qru);

$_SESSION['mensaje']['txt'] = ADM_SUCCES_SAVED;
$_SESSION['mensaje']['status'] = true;

$enableHeader = true;
}
//para grabar cuando pulso el boton rojo de invoice
if(($action_i=="save")and(!isset($_SESSION['invoice_id'])))
{
$q="select id from client_invoice WHERE name='".$id_pas."'";
$r=mysql_query($q)or die("ERRROR SLICE_SM_6.php".mysql_error());
if($ro=mysql_fetch_array($r))
{
$_SESSION['invoice_id']=$ro['id'];
}
$invoice_date1 =date('Y-m-d',strtotime($invoice_date1));
$invoice_date2 =date('Y-m-d',strtotime($invoice_date2));
$quer="UPDATE client_invoice SET nro= '".$id_num."', fecha= '".date('Y-m-d')."', name= '".$invoice_name."', direccion= '".$invoice_addr1.PARSER.$invoice_addr2."', sdate= '".$invoice_date1."', kdate= '".$invoice_date2."', descri= '".$desc."', subtotal= ".$sub_total.", descuento= ".$dis.", newtotal= ".$nt.", tax= ".$tax1.", taxmount=".$tax2.", total= ".$tot.", estatus= 'E' WHERE id=".$_SESSION['invoice_id'];
mysql_query($quer) or die('ERROR AL UPDATE EL REGISTRO PRINCIPAL 2 '.mysql_error().$quer);
//aqui se Actualiza los item con el nombre del proyecto
$qru="update item_pedidos set title='".$invoice_name."' where invoice_id=".$_SESSION['invoice_id']."";
mysql_query($qru)or die("ERROR FATAL UPDATE REGISTROS DE ITEMS (2.1)!!!".mysql_error().$qru);
unset($_SESSION['prop_invoice']);
$_SESSION['mensaje']['txt'] = ADM_SUCCES_SAVED;
$_SESSION['mensaje']['status'] = true;

$enableHeader = true;
}
// COPIAR UN INVOICE
if($action_i=="copy")
{
$query="select * from client_invoice where id = ".$_SESSION['invoice_id'];
$result=mysql_query($query);
if($row=mysql_fetch_array($result))
{
  #20 (permalink)  
Antiguo 23/09/2005, 17:57
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
//************************************************** *************************************//
$q_max = "select max(nro + 1) as idmax from client_invoice";
$r_max=mysql_query($q_max);
$ro_max=mysql_fetch_array($r_max);
$num_max = formato_num($ro_max['idmax']);
// crear un registro para capturar el ID

$micro = md5(microtime()."otracosa");
$query_1="INSERT INTO client_invoice (id, clients_id, slices_id, nro, fecha, name, direccion, sdate, kdate, descri, subtotal, descuento, newtotal, tax, taxmount,total, estatus) VALUES (NULL,".$row[1]." , ".$row[2].", '".$num_max."', '".$row[4]."', '".$micro."', '".$row[6]."', '".$row[7]."', '".$row[8]."', '".$row[9]."', ".$row[10].", ".$row[11].", ".$row[12].", ".$row[13].", ".$row[14].", ".$row[15].", '".$row[16]."')";
mysql_query($query_1)or die("INVOICE -- > ERROR EN EL 1er INSERT 1ero".mysql_error().$query_1);
//seleccion el id del registro anterior
$qu0="SELECT id from client_invoice where name = '".$micro."'";
$r0=mysql_query($qu0)or die("ERROR AL SELECCIONAR ID 2do".mysql_error());
if($row_s=mysql_fetch_array($r0))
{
$id_invoice=$row_s['id'];
}
//************************************************** *************************************//
//$query_1="INSERT INTO client_invoice (id, clients_id, slices_id, nro, fecha, name, direccion, sdate, kdate, descri, subtotal, descuento, newtotal, tax, taxmount,total, estatus) VALUES (NULL,".$row[1]." , ".$row[2].", ".$row[3].", '".$row[4]."', '".$micro."', '".$row[6]."', '".$row[7]."', '".$row[8]."', '".$row[9]."', ".$row[10].", ".$row[11].", ".$row[12].", ".$row[13].", ".$row[14].", ".$row[15].", '".$row[16]."')";
$query_up="UPDATE client_invoice SET name= '".$row[5]."' WHERE id=".$id_invoice;
mysql_query($query_up);
//copia de registros del invoice
$query_2="SELECT * FROM client_detalle_invoice where client_invoice_id=".$_SESSION['invoice_id'];
$result_2=mysql_query($query_2);
while($row_2=mysql_fetch_array($result_2))
{
$query_2_1="INSERT INTO client_detalle_invoice (id, fecha, client_invoice_id, items_id, slices_id, clients_id, descri, cantidad, costo, estatus) VALUES (NULL, '".$row_2[1]."', ".$id_invoice.", ".$row_2[3].", ".$row_2[4].", ".$row_2[5].", '".$row_2[6]."', ".$row_2[7].", ".$row_2[8].", '".$row_2[9]."')";
mysql_query($query_2_1);
}
//************************************************** **************************************//
$query_3="SELECT * FROM item_pedidos WHERE invoice_id=".$_SESSION['invoice_id'];
$result_3=mysql_query($query_3);
while($row_3=mysql_fetch_array($result_3))
{
$query_3_1="INSERT INTO item_pedidos (id, slices_id, items_id, invoice_id,fecha, modo, tipo, title, units, monto, doc_path, estatus) VALUES (NULL, ".$row_3[1].", ".$row_3[2].", ".$id_invoice.",'".$row_3[4]."', '".$row_3[5]."', '".$row_3[6]."', '".$row_3[7]."', ".$row_3[8].", ".$row_3[9].", ".$row_3[10].", '".$row_3[12]."')";
mysql_query($query_3_1);
}
$_SESSION['invoice_id']=$id_invoice;
$_SESSION['mensaje']['txt'] = MSG_6_111;
$_SESSION['mensaje']['status'] = true;

}
$enableHeader = true;
}
// BORRA UN INVOICE (falta borrar los items y los pedidos) ademas si es q tiene relacion con un proposal borrar tal relacion
if($action_i=="delete")
{
//eliminacion de la relacion con un proposal
// QUERY DE BORRADO - relacion entr proposal e invoice
/*$qr="DELETE FROM client_prop_inv WHERE client_invoice_id=".$_SESSION['invoice_id'];
mysql_query($qr) or die("<strong>Delete client_proposal<pre>".mysql_error()."</pre></strong>");*/
// QUERY DE BORRADO - detalle del invoice
//$qr="DELETE from client_detalle_invoice where client_invoice_id=".$_SESSION['invoice_id'];
$qr="UPDATE client_detalle_invoice SET estatus='B' WHERE client_invoice_id=".$_SESSION['invoice_id'];
mysql_query($qr) or die("<strong>Delete client_proposal<pre>".mysql_error()."</pre></strong>");
// QUERY DE BORRADO - productos por detalle
//$qr="delete from item_pedidos where invoice_id=".$_SESSION['invoice_id'];
$qr="UPDATE item_pedidos SET estatus='B' WHERE invoice_id=".$_SESSION['invoice_id'];
mysql_query($qr) or die("<strong>Delete client_proposal<pre>".mysql_error()."</pre></strong>");
// QUERY DE BORRADO - invoice
//$qr="DELETE FROM client_invoice WHERE id=".$_SESSION['invoice_id'];
$qr="UPDATE client_invoice SET estatus='B' WHERE id=".$_SESSION['invoice_id'];
mysql_query($qr) or die("<strong>Delete client_proposal<pre>".mysql_error()."</pre></strong>");
$_SESSION['client_estado']=1;
unset($_SESSION['invoice_id']);
$enableHeader = true;
}
// 6.4
if(isset($propInvoice)and($propInvoice!="")) {
$_SESSION['prop_invoice'] = $propInvoice;
}
// se cambia el estado del clients - Page
if(isset($cambia_client_estado))
{
unset($_SESSION['invoice_id']);
unset($_SESSION['client_profile_id']);
if($cambia_client_estado<3) {
unset($_SESSION['prop_invoice']);
}
if(!isset($_SESSION['prop_invoice'])) {
unset($_SESSION['proposal_id']);
}
$_SESSION['client_estado']=$cambia_client_estado;
$enableHeader = true;
}
//--------------------------------------------------------------------
// 6.2
if(isset($cambia_client_profile_estatus))
{
// se ACTIVA/DESACTIVA AL VENDOR
$dat = explode(PARSER,$cambia_client_profile_estatus);
if($dat[0]=='E'){ $new_st='D'; }else{ $new_st='E';}
$qr="UPDATE client_profile SET estatus='$new_st' WHERE id=".$dat[1];
mysql_query($qr) or die("<strong>Cambio de ESTATUS del Client<pre>".mysql_error()."</pre></strong>");
$enableHeader = true;
}
//-----------------------------------------------------------------------
// 6.3
// recoger variable que seleciona a un proposal creado
if(isset($propid)and(!is_null($propid))) {
$_SESSION['proposal_id'] = $propid;
$enableHeader = true;
}
//-----------------------------------------------------------------------
// 6.4
// recoger variable que seleciona a un invoice creado
if(isset($facid)and($facid!='')) {
$_SESSION['invoice_id'] = $facid;
$enableHeader = true;
}
//--------------------------------------------para borrar file
if(isset($delete_legal_file))
{
$qr="select path from client_files where id=".$delete_legal_file;
$re=mysql_query($qr) or die("<strong>Delete legal file<pre>".mysql_error()."</pre></strong>");
$row=mysql_fetch_array($re,MYSQL_ASSOC);
if($row['path']!=''){
$file_l=UPLOADS_DIR.$row['path'];
if(file_exists($file_l))
{
if(unlink($file_l))
{
// QUERY DE BORRADO
$qr="delete from client_files where id=".$delete_legal_file;
$re=mysql_query($qr) or die("<strong>Delete legal file<pre>".mysql_error()."</pre></strong>");
}
}
}
$enableHeader = true;
}
//-----------------------------------------------------------------------
if($enableHeader) {
// redireccion
header("Location: ".HOME_DIR);
exit;
}
?>
  #21 (permalink)  
Antiguo 23/09/2005, 17:58
Avatar de davidangel  
Fecha de Ingreso: abril-2005
Mensajes: 124
Antigüedad: 19 años
Puntos: 0
es un monton de trabajo es q ya me tengo q ir pero si no puedes mañana te ayudo ok
bye
  #22 (permalink)  
Antiguo 26/09/2005, 06:39
 
Fecha de Ingreso: agosto-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
Exclamación davidangel ... gracias por tu ayuda...

davidange gracias por tu ayuda .... me queda una inquitud ... falta codigo verdad? y la BD.

... Espero hoy lo podamos terminar.

Gracias.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:06.