Hi jorge,
I give you anotrhe aproach:
If you apply an object model in your case you can simplify the main object
transaction. For Example:
class transaction {
var $_client; // to manipulate this object use the client class
var $_vendedor; // to manipulate this object use the vendedor class
var $_items; // to manipulate this object use the item class
var $_taxes; // to manipulate this object use the taxes class
// declarate your transactions functions
function create($client_data,$vendor_data,$items_data,$taxes_data) {
$this->_client = new client;
$this->_vendor = new vendor;
$this->_items = new items;
$this->_taxes = new taxes;
$this->_client->get($client_data);
$this->_vendedor->get($vendedor_data);
$this->_taxes->get($taxes_data);
$this->_items->get($items_data);
// Now you storage into the data base you transaccion values
//eg
$sql = "insert into transaccion values
('{$this->_client[id]}','{$this->_vendedor[id]}','{$this->_items}','{$this->_taxes}')";
// and run the sql
}//end function create
}
class client{
var $_client;
// I use an single var to store data object. I return an array from data
base witn the user
//atributes or false on query crash
function create($client_data){
}
function get($get_client_parameters){
}
function update($client_data){
}
function remove(){
}
}
class vendedor{
var $_vendedor;
function create($vendedor_data){
}
function get($get_vendedor_parameters){
}
function update($vendedor_data){
}
function remove(){
}
}
class items{
var $_items;
function create($items_data){
}
function get($get_items_parameters){
}
function update($items_data){
}
function remove(){
}
}
class taxes{
var $_taxes;
function create($taxes_data){
}
function get($get_taxes_parameters){
}
function update($taxes_data){
}
function remove(){
}
}
This is an sample object model of your case. Take a look, and good luck my freind!!!
LM
var $total
> > var $client(array with all client info),
> > var $vendor(array...)
> > var $items(array with all items)
> > var $taxes(array with all taxes)
> > //method to create capture screen
> > funtion create_capture_screen
> > {
> > blaaa...
> > }
> > function register_transaction ...blalall
Quoting jorge <jorge@d...>:
> Thanks Chris:
> I will try to do it since its my first time ill be posting more
>
> Regards
>
>
> Jorge:)
> ----- Original Message -----
> From: "Chris Ralph" <webmaster@g...>
> To: "professional php" <pro_php@p...>
> Sent: Thursday, November 14, 2002 8:57 PM
> Subject: [pro_php] Re: OOP for beginers need some Part 2
>
>
> > That approach would work, and you'd have something like:
> >
> > $transaction = new transaction;
> > $transaction->create_capture_screen();
> > $transaction->register_transaction();
> >
> > If you had multiple classes (such as sales and purchases), this would be
> > useful to quickly distingish between which functions relate to sales, and
> > which relate to purchases..
> >
> > Anyway, it's up to you how you want to structure it, but you've got the
> > general idea of how classes and OO programming works, so best of luck to
> > you.
> >
> > Chris
> >
> >
> > > Hi Chris
> > I understand pretty well when we speak of cars t shirtts etc..
> > what i am trying to ask is
> > is it possible and wise to do something like this
> > for SALES of PURCHASES in a company
> >
> > class transaction
> > {
> > var $total
> > var $client(array with all client info),
> > var $vendor(array...)
> > var $items(array with all items)
> > var $taxes(array with all taxes)
> > //method to create capture screen
> > funtion create_capture_screen
> > {
> > blaaa...
> > }
> > function register_transaction ...blalall
> >
> > is this a correct aproach ?
> > to the task i am planning???
> >
> >
> > Thanks
> >
> > Jorge:)
>
>
>
>