forked from science-ation/science-ation
Missing file, that's why it wasn't converting properly
This commit is contained in:
parent
fbba2e7e20
commit
6049ce9edb
240
db/db.update.174.php
Normal file
240
db/db.update.174.php
Normal file
@ -0,0 +1,240 @@
|
||||
<?
|
||||
/* Copy of $report_stock as it exists for this db update */
|
||||
$report_stock = array();
|
||||
$report_stock['fullpage'] = array('name' => 'Letter 8.5 x 11 (3/4" margin)',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 7,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 9.5,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['fullpage_landscape'] = array('name' => 'Letter 8.5 x 11 Landscape (3/4" margin)',
|
||||
'page_width' => 11,
|
||||
'page_height' => 8.5,
|
||||
'label_width' => 9.5,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 7,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'L',
|
||||
);
|
||||
|
||||
$report_stock['fullpage_full'] = array('name' => 'Letter 8.5 x 11 (no margin)',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 8.5,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 11,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['fullpage_landscape_full'] = array('name' => 'Letter 8.5 x 11 Landscape (no margin)',
|
||||
'page_width' => 11,
|
||||
'page_height' => 8.5,
|
||||
'label_width' => 11,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 8.5,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'L',
|
||||
);
|
||||
|
||||
$report_stock['5161'] = array('name' => 'Avery 5161/5261/5961/8161, G&T 99189 (1"x4")',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 4,
|
||||
'x_spacing' => 0.15,
|
||||
'cols' => 2,
|
||||
'label_height' => 1,
|
||||
'y_spacing' => 0.00,
|
||||
'y_padding' => 0.05,
|
||||
'rows' => 10,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['5162'] = array('name' => 'Avery 5162/5262/5962/8162/8462, G&T 99190 (1 1/3"x4")',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 3.99,
|
||||
'x_spacing' => 0.187,
|
||||
'cols' => 2,
|
||||
'label_height' => 1.326,
|
||||
'y_spacing' => 0.00,
|
||||
'y_padding' => 0.30,
|
||||
'rows' => 7,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
$report_stock['5163'] = array('name' => 'Avery 5163/5263/5963/8163/8463, G&T 99181 (2"x4")',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 4,
|
||||
'x_spacing' => 0.1719,
|
||||
'cols' => 2,
|
||||
'label_height' => 2,
|
||||
'y_spacing' => 0.00,
|
||||
'rows' => 5,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['5164'] = array('name' => 'Avery 5164/5264/5964/8164, G&T 99763 (4"x3 1/3")',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 4,
|
||||
'x_spacing' => 3/16,
|
||||
'cols' => 2,
|
||||
'label_height' => 3 + 1/3,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 3,
|
||||
'page_format' => 'LETTER', /* tcpdf format */
|
||||
'page_orientation' => 'P', /* tcpdf orientation */
|
||||
|
||||
);
|
||||
$report_stock['nametag'] = array('name' => 'Cards 4"x3"',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 4,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 2,
|
||||
'label_height' => 3,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 3,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['letter_4up'] = array('name' => 'Fullpage, 4up',
|
||||
'page_width' => 8.5,
|
||||
'page_height' => 11,
|
||||
'label_width' => 4,
|
||||
'x_spacing' => 0.25,
|
||||
'cols' => 2,
|
||||
'label_height' => 5,
|
||||
'y_spacing' => 0.25,
|
||||
'rows' => 2,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['ledger'] = array('name' => 'Ledger/Tabloid 11 x 17',
|
||||
'page_width' => 11,
|
||||
'page_height' => 17,
|
||||
'label_width' => 11,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 17,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
$report_stock['ledger_landscape'] = array('name' => 'Ledger/Tabloid 11 x 17 Landscape',
|
||||
'page_width' => 17,
|
||||
'page_height' => 11,
|
||||
'label_width' => 17,
|
||||
'x_spacing' => 0,
|
||||
'cols' => 1,
|
||||
'label_height' => 11,
|
||||
'y_spacing' => 0,
|
||||
'rows' => 1,
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
);
|
||||
|
||||
function db_update_174_pre()
|
||||
{
|
||||
global $report_stock;
|
||||
$q = mysql_query("SELECT reports_id FROM reports_items WHERE `type`='option' AND `field`='type' AND `value`='label'");
|
||||
while(($r = mysql_fetch_assoc($q))) {
|
||||
$id = $r['reports_id'];
|
||||
|
||||
/* Get the stock */
|
||||
|
||||
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='option' AND `field`='stock' AND reports_id='$id'");
|
||||
if(mysql_num_rows($qq) != 1) {
|
||||
$stock = $report_stock['5164'];
|
||||
} else {
|
||||
$s = mysql_fetch_assoc($qq);
|
||||
$stock = $report_stock[$s['value']];
|
||||
}
|
||||
/* Now convert all fields */
|
||||
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='col' AND reports_id='$id'");
|
||||
while(($d = mysql_fetch_assoc($qq))) {
|
||||
// print_r($d);
|
||||
|
||||
/* All dimensions are still in inches */
|
||||
$x = ($d['x'] * $stock['label_width']) / 100;
|
||||
$y = ($d['y'] * $stock['label_height']) / 100;
|
||||
$w = ($d['w'] * $stock['label_width']) / 100;
|
||||
$h = ($d['h'] * $stock['label_height']) / 100;
|
||||
|
||||
/* Line height * 72 points/inch = point size */
|
||||
$fontsize = ($h / $d['lines']) * 72;
|
||||
|
||||
$on_overflow = 'scale';
|
||||
|
||||
/* Separate align */
|
||||
$opts = explode(" ", $d['align']);
|
||||
$align_opts = array ('left'=>'left', 'right'=>'right', 'center'=>'center');
|
||||
$valign_opts = array ('vtop'=>'top', 'vbottom'=>'bottom', 'vcenter'=>'middle');
|
||||
$align = 'left';
|
||||
$valign = 'top';
|
||||
foreach($opts as $o) {
|
||||
if(array_key_exists($o, $align_opts)) $align = $align_opts[$o];
|
||||
if(array_key_exists($o, $valign_opts)) $valign = $valign_opts[$o];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* map face to fontstyle, fontstyle is a comma separated list
|
||||
* that gets exploded on report_load, but 'face' can only have
|
||||
* one option "bold", so no commas are involved here */
|
||||
if($d['face'] == 'bold')
|
||||
$fontstyle = 'bold';
|
||||
else
|
||||
$fontstyle = '';
|
||||
|
||||
/* Finally, convert to mm */
|
||||
$x *= 25.4;
|
||||
$y *= 25.4;
|
||||
$w *= 25.4;
|
||||
$h *= 25.4;
|
||||
|
||||
// echo "x=>$x, y=>$y, w=>$w, h=>$h, fs=>$fontsize, style=>$fontstyle, on_overflow=>$on_overflow\n";
|
||||
// echo " align=>$align valign=>$valign\n";
|
||||
|
||||
mysql_query("UPDATE reports_items SET `x`='$x', `y`='$y',
|
||||
`w`='$w', `h`='$h',
|
||||
`fontsize`='$fontsize',
|
||||
`fontstyle`='$fontsyle',
|
||||
`on_overflow`='$on_overflow',
|
||||
`align`='$align',
|
||||
`valign`='$valign'
|
||||
WHERE id='{$d['id']}'");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function db_update_174_post()
|
||||
{
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user