Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Print data from mash subform

admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Print data from mash subform

Unread post by admin »

massiws,

Do you want to send me a copy to info@nubuilder.com and I'll take a look?

Steven
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Print data from mash subform

Unread post by massiws »

Steven,

I sent you a copy of my db.

Thank you very much
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Print data from mash subform

Unread post by admin »

massiws,

When the print button runs all carriage returns are (for various reasons) being removed from Before Browse.

So because you started with a comment, everything got commented out and no php got run.

To make it work I have just closed off each comment.

Code: Select all


/* Create a temp table with all appointments NOT-CLOSED and add a column with technician names */
$sql  = "CREATE TABLE #browseTable#";
$sql .= " SELECT * FROM appointment INNER JOIN (request, appointment_status, client)";
$sql .= " ON (app_req_id = req_id AND app_aps_id = aps_id AND req_cli_id = cli_id)";
$sql .= " WHERE app_aps_id <> '1504808820c931' AND app_aps_id <> '1504808787a1a9'";
nuDebug('run1-> '.$sql);
nuRunQuery($sql);

/* Add a column to temp table*/
$sql = "ALTER TABLE #browseTable# ADD tecnici VARCHAR(250) NOT NULL";
/*nuDebug('run2-> '.$sql);*/
nuRunQuery($sql);

/* Work on temp table*/
$sql = "SELECT * FROM #browseTable#";
/*nuDebug('run3-> '.$sql);*/
$rs = nuRunQuery($sql);

/* get technicians related to each appointment*/
while ($row = db_fetch_object($rs)) {
    $appID = $row->app_id;               /* get appointment ID*/
    $tecnici = getTechnician($appID);    /* get technician from DB*/
    $tecnici = $tecnici[0];              /* get only names*/
    
    /* Update temp table with technician names*/
    $sql = "UPDATE #browseTable# SET tecnici = '".$tecnici."' WHERE app_id = '".$appID."'";
    /*nuDebug('run4-> '.$sql);*/
    nuRunQuery($sql);
}


Steven
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Print data from mash subform

Unread post by massiws »

Steven,

it works!
I suggest to mention this procedure in related wiki pages.

Thank you.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Print data from mash subform

Unread post by admin »

massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Print data from mash subform

Unread post by massiws »

Perfect!
Now nobody can make mistakes!

Thanks.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Print data from mash subform

Unread post by admin »

.
Post Reply