Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
haciendo una factura sumar total factura
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Avilac3  
View profile  
 More options Aug 3 2012, 3:59 pm
From: Avilac3 <servidigitalne...@gmail.com>
Date: Fri, 3 Aug 2012 12:59:21 -0700 (PDT)
Local: Fri, Aug 3 2012 3:59 pm
Subject: haciendo una factura sumar total factura

hola amigo estoy trabajando en la forma de hacer una factura
Mis tablas Son:   una de productos , usuarios , facturas, factura_items

CREATE TABLE `productos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario_id` int(11) NOT NULL,
  `nombre` varchar(120) NOT NULL,
  `valor` varchar(10) NOT NULL,
  `activo` tinyint(1) NOT NULL,
  `fecha_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

CREATE TABLE `usuarios` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `login` varchar(50) COLLATE utf8_bin NOT NULL,
  `clave` varchar(40) COLLATE utf8_bin NOT NULL,
  `nombres` varchar(100) COLLATE utf8_bin NOT NULL,
  `apellidos` varchar(110) COLLATE utf8_bin NOT NULL,
  `cedula` int(25) NOT NULL,
  `email` varchar(100) COLLATE utf8_bin NOT NULL,
  `roles_id` int(11) NOT NULL,
  `refer_id` int(10) NOT NULL,
  `activo` tinyint(1) NOT NULL DEFAULT '1',
  `fecha_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `login` (`login`),
  KEY `roles_id` (`roles_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=18 ;

CREATE TABLE `facturas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario_id` int(11) NOT NULL,
  `fecha_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `activo` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

CREATE TABLE `factura_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `factura_id` int(11) NOT NULL,
  `usuario_id` int(11) NOT NULL,
  `producto_id` int(11) NOT NULL,
  `cantidad` int(11) NOT NULL,
  `fecha_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `activo` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

en donde primero se validan los datos del cliente y luego se crea el id de
la factura luego por medio de este id agrego los items a esa factura,
cuando agrego los items los guardo en factura_items el id_factura, el
id_producto y el id_cliente y la cantidad.

Código PHP:
 <?php foreach ($inner as $item) : ?>
    <tr>
      <td><? echo $item->cantidad; ?></td>
      <td><? echo $item->nombre; ?></td>
      <td><? echo number_format($item->valor); ?></td>
      <td><? $totalitem = $item->cantidad * $item->valor; echo number_format
($totalitem); ?></td>
    </tr>
        <?php endforeach; ?>
y cuando nuestro los datos hago una join para mostrar los datos y la
cantidad la multplico por el valor del producto alojado en la tabla
productos

hay todo bien tengo problemas en la parte en donde tengo X cantidad de
items en mi factura y quiero sumar total de todos

como lo debo hacer?

espero me entiendan y colaboren muchas gracias


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ServiDigital  
View profile   Translate to Translated (View Original)
 More options Aug 3 2012, 7:13 pm
From: ServiDigital <servidigitalne...@gmail.com>
Date: Fri, 3 Aug 2012 18:13:27 -0500
Local: Fri, Aug 3 2012 7:13 pm
Subject: Re: [KumbiaPHP 9060] haciendo una factura sumar total factura

Problema solucionado MUCHAS GRACIAS  :) [?][?][?][?][?][?]

El 3 de agosto de 2012 14:59, Avilac3 <servidigitalne...@gmail.com>escribió:

--

       SERVIDIGITAL NEIVA
   Nueva Direccion: Cra.  2 No.  15-48
   TEL: 8716259 - CEL: 3173914624

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Stivens  
View profile   Translate to Translated (View Original)
 More options Aug 3 2012, 7:47 pm
From: Henry Stivens <maxter2...@gmail.com>
Date: Fri, 3 Aug 2012 18:47:55 -0500
Local: Fri, Aug 3 2012 7:47 pm
Subject: Re: [KumbiaPHP 9060] haciendo una factura sumar total factura

¿Y cómo lo solucionaste?

2012/8/3 ServiDigital <servidigitalne...@gmail.com>

--
Henry Stivens Adarme Muñoz

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ServiDigital  
View profile   Translate to Translated (View Original)
 More options Aug 3 2012, 7:51 pm
From: ServiDigital <servidigitalne...@gmail.com>
Date: Fri, 3 Aug 2012 18:51:59 -0500
Local: Fri, Aug 3 2012 7:51 pm
Subject: Re: [KumbiaPHP 9061] haciendo una factura sumar total factura

Ps en si fue mas problema de la forma o estructura q estaba manejando ps no
estaba guardando el resultado de la multiplicacion de la cantidad y el
valor por unidad , si no que lo lo generaba y mostraba entonces asi no
podida hacer un                  sum

entonces
agregue ese campo en la tabla y guarde ese  valor y luego hice un
                 $this->total_factura = $listitems->sum('valor_item',
"conditions: factura_id=$idfactura");

eso si gracias a argordmel q me di a entender como era.

El 3 de agosto de 2012 18:47, Henry Stivens <maxter2...@gmail.com> escribió:

--

       SERVIDIGITAL NEIVA
   Nueva Direccion: Cra.  2 No.  15-48
   TEL: 8716259 - CEL: 3173914624

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Stivens  
View profile   Translate to Translated (View Original)
 More options Aug 3 2012, 7:53 pm
From: Henry Stivens <maxter2...@gmail.com>
Date: Fri, 3 Aug 2012 18:53:06 -0500
Local: Fri, Aug 3 2012 7:53 pm
Subject: Re: [KumbiaPHP 9062] haciendo una factura sumar total factura

OK, bien :)

2012/8/3 ServiDigital <servidigitalne...@gmail.com>

--
Henry Stivens Adarme Muñoz

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Edu. Flores  
View profile   Translate to Translated (View Original)
 More options Aug 5 2012, 3:59 am
From: "Edu. Flores" <e...@floresrobles.com>
Date: Sun, 5 Aug 2012 02:59:21 -0500
Local: Sun, Aug 5 2012 3:59 am
Subject: Re: [KumbiaPHP 9063] haciendo una factura sumar total factura

Ufff, yala!,

mentira Servidigital, buen trabajo, nunca use es función, buen punto no lo
había visto de esa forma la aplicación de sum().

Edu.

El 3 de agosto de 2012 18:53, Henry Stivens <maxter2...@gmail.com> escribió:

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
José M Martínez  
View profile   Translate to Translated (View Original)
 More options Aug 8 2012, 9:09 am
From: José M Martínez <josemmartin...@gmail.com>
Date: Wed, 8 Aug 2012 08:39:00 -0430
Subject: Re: [KumbiaPHP 9064] haciendo una factura sumar total factura

Buenos días Avilac

cuendo dices "cuando nuestro los datos hago una join para mostrar los datos
y la cantidad la multplico por el valor del producto alojado en la tabla
productos"

te recomiendo que para mostrar la factura no la multipliques por el valor
que tienes guardado en la tabla productos, en el futuro estos valores
pueden cambiar y si luego deseas consultar una factura que ya fue emitida
es posible que no te muestre los valores reales con que se vendieron los
productos.

El 5 de agosto de 2012 03:29, Edu. Flores <e...@floresrobles.com> escribió:

--
*JMMC*
@Chemi_

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ServiDigital  
View profile   Translate to Translated (View Original)
 More options Aug 8 2012, 9:13 am
From: ServiDigital <servidigitalne...@gmail.com>
Date: Wed, 8 Aug 2012 08:13:09 -0500
Local: Wed, Aug 8 2012 9:13 am
Subject: Re: [KumbiaPHP 9065] haciendo una factura sumar total factura

Jose cual seria la forma correcta de hacer eso. ??
gracias por tu aporte.

El 8 de agosto de 2012 08:09, José M Martínez
<josemmartin...@gmail.com>escribió:

--

       SERVIDIGITAL NEIVA
   Nueva Direccion: Cra.  2 No.  15-48
   TEL: 8716259 - CEL: 3173914624

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oscar Cid  
View profile   Translate to Translated (View Original)
 More options Aug 8 2012, 10:13 am
From: Oscar Cid <ocid.figue...@gmail.com>
Date: Wed, 8 Aug 2012 10:13:59 -0400
Local: Wed, Aug 8 2012 10:13 am
Subject: Re: [KumbiaPHP 9066] haciendo una factura sumar total factura

personalmente, yo dejo todos los valores que se calcularon en el momento de
emitir cotizacion, boleta o factura en las mismas tablas, los campos
totalizadores quedan en la tabla maestra y los detalle, en la detalle
obviamente. asi, hago los calculos una vez y me quedan los valores que
correspondia en el momento en el que se hicieron, ademas de resgistrar los
posibles descuentos que se le hicieron a los productos.

El 8 de agosto de 2012 09:13, ServiDigital
<servidigitalne...@gmail.com>escribió:

  332.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »