Ask your Symfony questions! Pay money and get answers fast! (more info)

Dynamic Double List Symfony

  • REFUNDED

I am making a system for schools where one of the system function is to be able to have a list of products where in I have the name of the product, a description, a type(only two types, a services or supply), the unitary price, and how much are there available.

Then I have another table where i make the bill, where I have the school(because the system is for 6 schools of the same Organization), the receipt number, the user making the bill, payment type, student, discount, weather to apply discount, taxes, weather to apply taxes, subtotal, total , and if the bill has been fully payed.

And another table to connect this two.

So in the end the schema looks like this:
Factura:
actAs: { Timestampable: ~ }
columns:
escuela_id: { type: integer, notnull: true }
recibo_sistema: { type: string(255), notnull: true, unique: false }
facturador_id: { type: integer, notnull: true }
tipo_compra: { type: string(255), notnull: true, unique: false }
estudiante_id: { type: integer, notnull: true, unique: false }
aplicar_descuento: { type: string(255), notnull: true, unique: false }
pocentaje_descuento: { type: float, notnull: true, unique: false }
aplicar_IV: { type: string(255), notnull: true, unique: false }
porcentaje_IV: { type: float, notnull: true, unique: false }
subtotal: { type: float, notnull: true, unique: false }
total: { type: float, notnull: true, unique: false }
deuda_cancelada: { type: string(255), notnull: true, unique: false }
relations:
Escuela: { class: Escuela, local: escuela_id, foreign: id, foreignAlias: Facturas }
Estudiante: { class: Estudiante, local: estudiante_id, foreign: id, foreignAlias: Facturas }
Usuario: { class: sfGuardUser, local: facturador_id, foreign: id, foreignAlias: Facturas }
Producto: { class: Producto, local: factura_id, foreign: producto_id, foreignAlias: Facturas, refClass: FacturaProducto }

Producto:
actAs: { Timestampable: ~ }
columns:
nombre: { type: string(255), notnull: true, unique: false }
descripcion: { type: string(255), notnull: true, unique: false }
tipo: { type: string(255), notnull: true, unique: false }
precio_unitario: { type: float, notnull: true, unique: false }
cantidad_disponible: { type: int, notnull: true, unique: false }
relations:
Factura: { class: Factura, local: producto_id, foreign: factura_id, foreignAlias: Productos, refClass: FacturaProducto }

FacturaProducto:
actAs: [Timestampable]
columns:
factura_id: { type: integer, primary: true }
producto_id: { type: integer, primary: true }
relations:
Factura: { class: Factura, local: factura_id, onDelete: CASCADE }
Producto: { class: Producto, local: producto_id, onDelete: CASCADE }


What I need, and getting to my problem is that if I am making a bill, they can add any product they need and any amount they(students) need(if the theres availability).

So I was thinking in using a Double List where they can add from one side to another.

Here is an image to explain better the idea.
http://img171.imageshack.us/img171/8692/screenshot20110323at946.png
<img>http://img171.imageshack.us/img171/8692/screenshot20110323at946.png</img>

**NOTE**
I force with Firebug to look like it works but it doesnt


I was trying to modify the sfFormExtraPlugin by modifying the double list they provide, but I had no success.

I need this or an alternative idea but with the same functionality to do this.

Can you someone please code me something up? I am desperate because it has been like 3 weeks with this problem and no solution and I have to finish this soon.

PLEASE HELP

Answers (1)

2011-03-25

Deven Patel answers:

hi

i have develop like this.
i have attechment screen please see and if u want then .i'll send you code for that.
i hope u want like this.


Javier Espinoza comments:

Will that code be able to manage quantities? Because thats what I need, to be able to add quantities of the same product.

If you code does that and is able to save correctly with Doctrine that YES, PLEASE SEND IT!