Page 2 of 2

Re: Print data from mash subform

Posted: Thu Nov 01, 2012 6:18 am
by admin
massiws,

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

Steven

Re: Print data from mash subform

Posted: Thu Nov 01, 2012 11:11 am
by massiws
Steven,

I sent you a copy of my db.

Thank you very much

Re: Print data from mash subform

Posted: Fri Nov 02, 2012 4:08 am
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

Re: Print data from mash subform

Posted: Fri Nov 02, 2012 3:59 pm
by massiws
Steven,

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

Thank you.

Re: Print data from mash subform

Posted: Tue Nov 06, 2012 5:05 am
by admin

Re: Print data from mash subform

Posted: Tue Nov 06, 2012 8:54 pm
by massiws
Perfect!
Now nobody can make mistakes!

Thanks.

Re: Print data from mash subform

Posted: Tue Nov 06, 2012 11:41 pm
by admin
.