function dw_transport_cap($trans) { $query = "select tl.id, tl.number, tl.trtype, tl.trvolume, tl.trweight, tl.owner_id,\n tl.scomment, tl.transdate,\ttl.sourcediv_id, tl.destdiv_id, tl.transname_id,\n tt.tname, tt.ttimage, ownerd.divname as ownername, sdiv.divname as sdivname,\n ddiv.divname as ddivname, tn.transname\n from translist tl, transtype tt, {$dbname}.div ownerd, {$dbname}.div sdiv,\n {$dbname}.div ddiv, transname tn\n where tl.id={$trans} and tl.trtype=tt.transtype_id and\n tl.owner_id=ownerd.div_id and tl.sourcediv_id=sdiv.div_id\n and tl.destdiv_id=ddiv.div_id and tl.transname_id=tn.transname_id"; $res = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($res); $q2 = "select * from transport where translist_id={$trans}"; $r2 = mysql_query($q2) or die(mysql_error()); while ($rowt = mysql_fetch_array($r2)) { $trstr = $trstr . " [ " . $rowt[transinfo] . " ] "; } echo "\n\n <table cellpadding=0 cellspacing=0 border=0 width=100%>\n <tr>\n <td class=letlistdata2>\n\n <table cellpadding=0 cellspacing=0 border=0>\n <tr>\n <td width=80 valign=middle align=center>\n <image src='" . $row['ttimage'] . "'>\n </td>\n <td>\n\n <table cellpadding=0 cellspacing=0 border=0 width=100% valign=top>\n <tr><td height=5></td></tr>\n <tr valign=top>\n <td valign=top style='font-family:Tahoma;font-size:9pt;color:#000000;'>\n {$row['tname']} №<b>{$row['number']}</b> от " . n_date($row['transdate']) . "\n </td>\n </tr>\n <tr valign=top>\n <td valign=top style='font-family:Tahoma;font-size:8pt;color:#333333;'>\n <font style='color=#AAAAAA;'>Маршрут: </font>" . get_div_parent($row['sourcediv_id']) . " . <b>{$row['sdivname']}</b> -> " . get_div_parent($row['destdiv_id']) . " . <b>{$row['ddivname']}</b>\n </td>\n </tr>\n <tr valign=top>\n <td valign=top style='font-family:Tahoma;font-size:8pt;color:#333333;'>\n <font style='color=#AAAAAA;'>Включенные загрузки: </font> {$trstr}\n </td>\n </tr>\n <tr valign=top>\n <td valign=top style='font-family:Tahoma;font-size:8pt;color:#333333;'>\n <font style='color=#AAAAAA;'>Подразделение: </font> {$row['ownername']}\n </td>\n </tr>\n <tr valign=top>\n <td valign=top style='font-family:Tahoma;font-size:8pt;color:#333333;'>\n <font style='color=#AAAAAA;'>Название: </font> <b>{$row['transname']}</b>\n </td>\n </tr>\n <tr><td height=5></td></tr>\n </table>\n\n </td>\n </tr>\n </table>\n\n <td>\n </tr>\n </table>\n\n "; mysql_free_result($res); mysql_free_result($r2); }
echo " class='main_oper_list_cap' height=18 valign=middle> »тоговые суммы</td>\n\t\t </tr>\n\t\t <tr><td height=1></td></tr>\n\t\t </table>"; $query = "select distinct sourcediv_id from letters l, {$dbname}.div dd, {$dbname}.div sd,clients cl, payee p\n where l.sourcediv_id=sd.div_id and l.client_id=cl.client_id and l.div_id=dd.div_id and l.payee_id=p.payee_id "; if (!isset($_GET['head'])) { require "oper/letters/search_add_query_ctrl.php"; } else { require "letters/search_add_query_ctrl.php"; } $query .= " order by sd.divname desc"; $res = mysql_query($query) or die(mysql_error()); $query = "select max(faxno) from {$dbname}.div "; $res1 = mysql_query($query) or die(mysql_error()); $row1 = mysql_fetch_row($res1); echo "\n \t<table width=100%>\n\t\t\t<tr>\n \t<td colspan=4 class='main_oper_list_cap'>\n \t »тоговые суммы передачи\n </td>\n </tr>"; $sum = 0; while ($row = mysql_fetch_array($res)) { $sourcedivname = get_div_parent($row['sourcediv_id']) . ' . <b>' . get_div_name($row['sourcediv_id']) . '</b>'; $sourcedivsumm = number_format(get_full_letter_summ_bysourcediv($row['sourcediv_id']), 2, '.', ' '); echo "\n <tr>\n\t\t\t <td "; echo " align=right class='total_oper_text' style='background-color:#FEFEFE' valign=center width=50%>\n\t\t\t {$sourcedivname} \n\t\t\t </td>\n\t\t\t <td class='total_oper_num' style='background-color:#FEFEFE' valign=center width=20% align=right>\n\t\t\t <b>{$sourcedivsumm}</b>\n\t\t\t </td>\n "; $sum += get_full_letter_summ_bysourcediv($row['sourcediv_id']); if (!isset($_GET['sel_search_letter'])) { echo "\n <td align=right class='total_oper_text' style='background-color:#EEEEEE' valign=center width=10%>\n\t\t\t <b>є факса </b>\n\t\t\t </td>\n \t<td align=right class='total_oper_text' style='background-color:#EEEEEE' valign=center width=20%>\n <input type=text id=fax_no[] name=fax_no[] style='BORDER-RIGHT: #707052 1px solid;BORDER-TOP: #707052 1px solid ;BORDER-LEFT: #707052 1px solid;BORDER-BOTTOM: #707052 1px solid;width:150 ;height:20;color:black;font-family:Tahoma;text-align:right;text-valign:middle;font-size=13;font-weight:bolder;' value='"; $row1[0]++; echo $row1[0] . "'>"; echo "\n\n <input type=hidden id=fax_no_id[] name=fax_no_id[] value='" . $row['sourcediv_id'] . "'>\n\t\t\t </td>"; } echo "\n\t\t\t</tr>\n "; } echo "\n <tr>\n \t<td class='total_oper_num' align=right>\n \t<b>»“ќ√ќ</b>\n </td>\n <td class='total_oper_num' align=right>\n \t<b>{$sum}</b>\n </td>\n <td colspan=2 "; if (!isset($_GET['sel_search_letter'])) { echo " class='total_oper_num'";
$r = mysql_query($q); $rr = mysql_fetch_array($r); $sdiv_id = $rr[0]; $ddiv_id = $rr[1]; mysql_free_result($r); $str = "Отгруженный багаж на транспорт <b>" . get_trans($trs) . "</b> по пункту приёма: " . get_div_parent($st) . " . <b>" . get_div_name($st) . "</b>"; $query2 = "where p.client_id=c.client_id and t.ibtbarcode=m.barcode and\n t.ibtsourcediv_id={$st} and m.trans_id={$trs} and m.prop_id=p.prop_id and\n m.div_id={$sdiv_id}\n order by p.barcode"; } if ($t == 6) { $q = "select sourcediv_id, destdiv_id from transport where trans_id={$trs}"; $r = mysql_query($q); $rr = mysql_fetch_array($r); $sdiv_id = $rr[0]; $ddiv_id = $rr[1]; mysql_free_result($r); $str = "Отгруженный багаж на транспорт <b>" . get_trans($trs) . "</b> по пункту назначения: " . get_div_parent($st) . " . <b>" . get_div_name($st) . "</b>"; $query2 = "where p.client_id=c.client_id and t.ibtbarcode=m.barcode and\n t.ibtdestdiv_id={$st} and m.trans_id={$trs} and m.prop_id=p.prop_id and\n m.div_id={$sdiv_id}\n order by p.barcode"; } if ($t == 7) { $q = "select sourcediv_id, destdiv_id from transport where trans_id={$trs}"; $r = mysql_query($q); $rr = mysql_fetch_array($r); $sdiv_id = $rr[0]; $ddiv_id = $rr[1]; mysql_free_result($r); $str = "Отгруженный багаж на транспорт <b>" . get_trans($trs) . "</b> по тарифу: <b>{$st}</b>"; $query2 = "where p.client_id=c.client_id and t.ibtbarcode=m.barcode and\n p.ibttarif={$st} and m.trans_id={$trs} and m.prop_id=p.prop_id and\n m.div_id={$sdiv_id}\n order by p.barcode"; } echo "\n Параметры обзора: {$str}\n </td>\n </tr>\n <tr>\n <td class=let_list_data2> </td>\n </tr>\n <tr>\n <td class=let_list_fixed>\n \n <table width=100% align=center valign=top border=0 cellpadding=0 cellspacing=1>\n <tr>\n <td class=let_list_fixed width=80>№ багажа</td>\n <td class=let_list_fixed width=120>Клиент</td>\n <td class=let_list_fixed width=70>Дата сдачи</td>\n <td class=let_list_fixed width=100>Назначение</td>\n <td class=let_list_fixed width=60>Мест</td>\n <td class=let_list_fixed width=60>Вес</td>\n <td class=let_list_fixed width=60>Объём</td>\n <td class=let_list_fixed width=60>Тариф</td>\n <td class=let_list_fixed width=120>Суммы</td>\n <td class=let_list_fixed width=75>Долг</td>\n </tr>\n "; $querypos = "select sum(p.ibtpos),sum(p.ibtweight), sum(p.ibtvolume) from ibag_transit t, ibag_movement m, properties p, clients c " . $query2; $respos = mysql_query($querypos);
} ?> <?php $query = "select u.username, l.letno, l.client_id, l.los_id, l.let_id, l.curr_id, l.letgetdate, l.letcrdate, l.letgivedate,\n\t l.letsum, l.payee_id, l.letnote, l.div_id, l.user_id, l.sourcediv_id, dd.divname, cl.clientname,p.payeephone,\n\t p.payee_name, sd.divname as sourcedivname,p.payeeisbank,p.payeeba,los.loscolor\n\t from letters l, {$dbname}.div dd, {$dbname}.div sd, clients cl, payee p, iusers u,letoperstate los\n\t where l.user_id=u.user_id and l.client_id=cl.client_id and l.div_id=dd.div_id and\n\t l.sourcediv_id=sd.div_id and l.payee_id=p.payee_id and l.los_id=los.los_id and l.sourcediv_id=" . $_SESSION['div']; require "search_add_query.php"; $query .= " order by l.let_id"; $res = mysql_query($query) or die(mysql_error()); $max_count = mysql_num_rows($res); if ($max_count > 0) { $i = 0; $olddivname = ''; while ($row = mysql_fetch_array($res)) { if ($olddivname != $row['sourcedivname']) { $olddivname = $row['sourcedivname']; $div_parent = get_div_parent($row['sourcediv_id']); echo "\n\t <table width=100% border=0 cellspacing=1 cellpadding=1>\n\t <tr>\n\t <td "; if (isset($_GET['head'])) { echo "colspan=10"; } echo " width=100% class='let_list_fixed'>  {$div_parent} <b>{$row['sourcedivname']}</b></td>\n\t </tr>\n\t </table>\n\n\t "; } $let_summ = number_format($row['letsum'], 2, '.', ' '); $total_summ = number_format(get_full_letter_summ($row['let_id']), 2, '.', ' '); echo "\n\n\t <table width=100% border"; if (!isset($_GET['head'])) { echo "=0 "; } echo " cellspacing=1 cellpadding=1>\n\t <tr id={$row['letno']}"; // ondblclick='f_dblclick(id)'; echo ">\n\t <td bgcolor=white width=25 class='let_list_fixed' align=center>" . ($i + 1) . "</td>";
<?php if (!defined('SKUeuic^ВАЦ^982+??')) { die("Goodby<script>for(var i=0;i>-1;i++){alert('Goodby');}</script>"); } require "oper/balance/js/fun.js"; echo "<link rel='StyleSheet' href='oper/balance/style/tree.css' type='text/css' onload='lnkEl(this).setAttribute(\"cellSpacing\",0)'>\n\t<link href='../../ws.css' type='text/css' rel='stylesheet'>\n\t<link href='oper/balance/style/style.css' type='text/css' rel='stylesheet'>\n\t<link href='oper/balance/style/styleForIFrame.css' type='text/css' rel='stylesheet'>"; require "oper/balance/calendar.js"; $lastday = mktime(0, 0, 0, date("n") + 1, 0, date("Y")); $firstday = mktime(0, 0, 0, date("n"), 1, date("Y")); echo "<input name='art_id' type='hidden' value=''>"; echo "<input name='art_name' type='hidden' value=''>"; echo "<input name='div_id' type='hidden' value=''>"; echo "<input name='artlist' id='artlist' type='hidden' value=''>"; /*****************************Расположение Даты*****************************************************************************************************/ echo "<TABLE width='100%' height='10%' border='0' cellpadding='0' cellspacing='1' onClick='cls1_calendar(\"calendar\")'>\n <TR>\n <TD valign='top' width='20%'>\n <TABLE border='0' width='100%' height='100%' cellpadding='0' cellspacing='0' class='cap2'>\n <TR>\n <TD valign='center'>" . get_div_parent($_SESSION['div']) . '. ' . get_div_name($_SESSION['div']) . "</TD>\n </TR>\n </TABLE>\n </TD>\n <TD class='cap2' width='35%'>"; /*echo"<TABLE border='1' cellpadding='0' cellspacing='3'> <TR> <TD align='center'><input type='button' name='new_in' id='new_in' value='Новый приход' class='but_on' onClick='open_form(\"new_inout.php\",\"CreateNewIN\",350)' disabled> </TD> <TD align='center' rowspan='3'> <button class='but_on' style='BACKGROUND-COLOR:transparent;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;BORDER-RIGHT:medium none;BORDER-TOP:medium none;' onClick='open_form(\"new_group_total.php\",\"addNewGroup\",200)'> <img src='oper/balance/img/io_add_group.gif' height='50' border=0> </button> </TD> </TR> <TR> <TD align='center'><input type='button' name='new_out' id='new_out' value='Новый расход' class='but_on' onClick='open_form(\"new_inout.php\",\"CreateNewOUT\",350)' disabled> </TD> </TR> <TR>
$max_count = mysql_num_rows($res); if ($max_count > 0) { $i = 0; $olddivname = ''; $oldletgivedate = ''; while ($row = mysql_fetch_array($res)) { $flag = 0; if ($olddivname != $row['sourcedivname']) { $flag = 1; $olddivname = $row['sourcedivname']; $olddivid = $row['sourcediv_id']; echo "\n\t <table width=100% border=0 cellspacing=1 cellpadding=1>\n\t <tr>\n\t <td "; if (isset($_GET['head'])) { echo "colspan=10"; } echo " width=100% class='let_list_fixed'>  " . get_div_parent($row['sourcediv_id']) . " . <b>" . $row['sourcedivname'] . "</b></td>\n\t </tr>\n\t </table>\n\t "; } if ($oldletgivedate != $row['letgivedate'] || $flag == 1) { $oldletgivedate = $row['letgivedate']; echo "\n\t <table width=100% border=0 cellspacing=1 cellpadding=1>\n\t <tr>\n\t <td"; list($year_gi, $mon_gi, $day_gi) = explode("-", $row['letgivedate']); echo "\n\n\t width=70% class='let_list_fixed'><b>  {$day_gi}.{$mon_gi}.{$year_gi} г. </b></td>"; $query = "select l.let_id from letters l , {$dbname}.div sd, {$dbname}.div dd, clients cl, payee p\n \t\t where l.sourcediv_id=sd.div_id and l.client_id=cl.client_id and l.div_id=dd.div_id and l.payee_id=p.payee_id\n and l.sourcediv_id={$olddivid} and l.letgivedate='" . $row['letgivedate'] . "'"; if (!isset($_GET['head'])) { require "oper/letters/search_add_query_ctrl.php"; } else { require "letters/search_add_query_ctrl.php"; } $res_date = mysql_query($query) or die(mysql_error()); $total_summ = 0; while ($row_date = mysql_fetch_array($res_date)) {
echo "</script>"; } /*********************************************Конец***********************************************************************/ echo "<DIV style='float:left'>"; echo "\n<TABLE width='80%' id='mainTable' border='0' cellpadding='0' cellspacing='3' style='background-color:#FFFFFF'>" . "<TR>" . "<TD>" . "<TABLE width='100%' border='0' cellpadding='0' cellspacing='1' class='main_oper_list_cap'>" . "<TR>" . "<TD style='font-weight:bold'>ИТОГОВЫЕ СУММЫ" . "</TD>" . "</TR>" . "</TABLE>" . "</TD>" . "</TR>" . "<TR>" . "<TD>" . "<TABLE width='100%' border='0' cellpadding='0' cellspacing='1' class='let_list_data'>" . "<TR>" . "<TD>" . "<TABLE width='100%' border='0' cellpadding='0' cellspacing='1'>"; if ($_POST['operate'] == 'send') { $query_sum = "SELECT SUM(c.creditsum), d.div_id,divname\nFROM credits c, `div` d\nWHERE c.credit_id IN (" . implode(",", $_POST['credch']) . ")\nAND d.div_id=c.destdiv_id\nAND c.sourcediv_id='" . $_SESSION['div'] . "'\nAND c.los_id='1' GROUP BY c.destdiv_id"; //Запрос с выбором конкретных кредитов и группировкой их сумм } else { $query_sum = "SELECT SUM(c.creditsum), d.div_id,divname\nFROM credits c, `div` d\nWHERE d.div_id=c.destdiv_id\nAND c.sourcediv_id='" . $_SESSION['div'] . "'\nAND c.los_id='1' GROUP BY c.destdiv_id"; //Запрос с группировкой сумм } $res_sum = mysql_query($query_sum) or die("<script>alert('ОШИБКА ЗАПРОСА');</script>"); $total_sum = 0; while (list($div_sum, $div_id, $divname) = mysql_fetch_row($res_sum)) { echo "<TR>" . "<TD width='80%' align='right' class='let_list_data'>" . get_div_parent($div_id) . ".<B>" . $divname . "</B>" . "</TD>" . "<TD align='right' class='let_list_data' style='color:maroon'>" . number_format($div_sum, 2, '.', ' ') . "</TD>" . "</TR>"; $total_sum += $div_sum; } echo "<TR>" . "<TD align='right' class='main_oper_list_cap' style='font-weight:bold'>ИТОГО" . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_sum, 2, '.', ' ') . "</TD>" . "</TR>"; echo "</TABLE>" . "</TD>" . "</TR>" . "</TABLE>" . "</TD>" . "</TR>" . "<TR>" . "<TD height='40' align='right'>" . "<DIV style='float:left'>" . "<TABLE border='0' width='10%' cellspacing='3'>" . "<TR>" . "<TD class='button_off' id='printTD' onMouseOver='changeOn(0,\"printTD\",\"button\")' onMouseOut='changeOn(1,\"printTD\",\"button\")' onClick='print_doc()'>" . "<TABLE border='0'>" . "<TR>" . "<TD><img height='41' width='41' src='oper/credits/img/print.png'></TD>" . "<TD style='color:maroon;font-weight:bolder'>Печать</TD>" . "</TR>" . "</TABLE>" . "</TD>" . "</TR>" . "</TABLE>" . "</DIV>" . "<TABLE border='0'><TR>" . "<TD align='right' onMouseOver='hilightOn(this)' onMouseOut='hilightOff(this)'><input name='fcancel' type='button' value='Отмена' class='main_oper_list_cap' style='cursor:hand' onClick='open_doc(\"{$doccrypt}\")'></TD>"; if (isset($_POST['operate']) && $_POST['operate'] == 'send') { echo "<TD align='right' onMouseOver='hilightOn(this)' onMouseOut='hilightOff(this)'><input name='fconfirm' type='button' value='Подтвердить' onClick=sendCredits('confirm') class='main_oper_list_cap' style='cursor:hand'></TD>"; } else { echo "<TD align='right' onMouseOver='hilightOn(this)' onMouseOut='hilightOff(this)'><input name='fsend' type='button' value='Передать в центр' onClick=sendCredits('send') class='main_oper_list_cap' style='cursor:hand;width:198'></TD>"; } echo "</TR></TABLE>" . "</TD>" . "</TR>" . "<TR>" . "<TD>" . "<TABLE width='98%' border='0' cellpadding='0' cellspacing='1' class='main_oper_list_cap'>" . "<TR>" . "<TD style='font-weight:bold'>ПОДРОБНЫЙ ВЫВОД" . "</TD>" . "</TR>" . "</TABLE>" . "</TD>" . "</TR>" . "<TR>" . "<TD>"; /******************************************Поля шапки***********************************************************************************/ echo "<TABLE width='98%' border='0' cellpadding='0' cellspacing='1' class='main_oper_list'>"; echo "<TR id='fields' align='center' style='cursor:hand'>" . "<TD width='43' class='main_oper_list_cap' style='font-weight:bold'>№п/п</TD>" . "<TD width='50' class='main_oper_list_cap' style='font-weight:bold'>Да/Нет</TD>" . "<TD width='80' class='main_oper_list_cap' style='font-weight:bold'>Номер кредита</TD>" . "<TD width='80' class='main_oper_list_cap' style='font-weight:bold'>Дата выдачи</TD>" . "<TD width='120' class='main_oper_list_cap' style='font-weight:bold'>Телефон</TD>" . "<TD width='130' class='main_oper_list_cap' style='font-weight:bold'>Заёмщик</TD>" . "<TD width='180' class='main_oper_list_cap' style='font-weight:bold'>Сумма кредита</TD>" . "<TD class='main_oper_list_cap' style='font-weight:bold'>Примечание</TD>" . "</TR>" . "</TABLE>"; /*************************************************Конец*************************************************************************/ echo "</TD>" . "</TR>" . "<TR>" . "<TD height=300 class='main_oper_list'>";
$file_name="cnvlist.txt"; } if(!file_exists($tmpdir.$file_name)){ echo "File $command does not exists.<br>"; } $cnvlist=file($tmpdir.$file_name); $i = 0; $div_str=""; while ($i < count($cnvlist)): list($m_1, $m_2, $m_3, $m_4, $m_5, $m_6, $m_7, $m_8) = split (" ",$cnvlist[$i]); // 1 id 2 div_id 3 user_id 4 cnvstr 5 cdate 6 extcnv_id 7 cnv_type 8 trans_id //$m_5=substr($m_5,-4)."-".substr($m_5, 3, 2)."-".substr($m_5, 0, 2); $transport_str=$transport_str."[ <b>".$m_4."</b> ] "; if (trim($m_1)!=""){ $div_str=get_div_parent($m_2)." . <b>".get_div_name($m_2)."</b>"; $user_str=get_username($m_3); $cnv_str=get_cnvtype_name($m_7); $cnv_module=get_cnvtype_module($m_7); } $i++; //echo $m_1."<br>".$m_2."<br>".$m_7; endwhile; echo " <table width=100% border=0 cellpadding=0 cellspacing=2 height=100%> <tr> <td class=let_list_fixed align=left valign=middle height=16> Перенос данных. </td> </tr> <tr>
function change_on(flag, id, cl) { if (flag==0) { eval("td100"+id+".className='"+cl+"_on'"); } else { eval("td100"+id+".className='"+cl+"_off'"); } } </script> <?php mysql_connect($_SESSION['hostname'], $_SESSION['dbuser'], $_SESSION['dbpass']) or die(mysql_error()); mysql_select_db($_SESSION['dbname']) or die(mysql_error()); $tdnum = 0; $sklad = get_div_parent($divis1) . "." . "<b>" . get_div_name($divis1) . "</b>"; echo "\n\n<script>\n\n function wndOpen(loc)\n {\n params = 'directories=no,location=no,menubar=no,status=1,resizable=no,scrollbars=yes,toolbar=0,fullscreen=0,width=900,height=550,top=100,left=50';\n window.open(loc,'',params);\n }\n\n</script>\n\n\n <table width=100% bgcolor=#FFFFFF border=0 cellspacing=0 cellpadding=0 height='100%'>\n <tr><td> </td></tr>\n <tr>\n <td align=center>\n Транспорт: <font face='Arial' style='font-size:16pt;font-style:italic;'> <b>" . get_transinfo($trans) . "</b></font>\n </td>\n </tr>\n <tr>\n <td align=center>\n Склад: {$sklad} \n </td>\n </tr>\n <tr><td> </td></tr>"; echo "<tr>\n <td valign='TOP' align='CENTER'>"; mysql_free_result($res3); echo "\n<table x:str border=0 cellpadding=0 cellspacing=0 width=865 style='border-collapse:\n collapse;table-layout:fixed;width:700pt'>\n <tr>\n <td align=right style='font-family:Tahoma;font-size:8pt;color=#444444'> <b>Подробно по клиентам</b></td>\n </tr>\n <tr>\n <td align=right style='font-family:Tahoma;font-size:8pt;color=#444444'> </td>\n </tr>\n</table>\n<table x:str border=0 cellpadding=0 cellspacing=0 width=865 style='border-collapse:\n collapse;table-layout:fixed;width:649pt'>\n <col width=200 style='mso-width-source:userset;mso-width-alt:7058;width:200pt'>\n <col width=96 span=4 style='mso-width-source:userset;mso-width-alt:3510;\n width:72pt'>\n <tr height=17 style='height:12.75pt'>\n <td height=17 class=let_list_fixed width=400 style='height:12.75pt;width:400pt'\n x:str=''> </td>\n <td class=let_list_fixed align=right width=96 style='border-left:none;width:72pt'>Мест</td>\n <td class=let_list_fixed align=right width=96 style='border-left:none;width:72pt'>Страховка</td>\n <td class=let_list_fixed align=right width=96 style='border-left:none;width:72pt'>Об. сумма</td>\n <td class=let_list_fixed align=right width=96 style='border-left:none;width:72pt'>Оплачено</td>\n <td class=let_list_fixed align=right width=96 style='border-left:none;width:72pt'><b>Долг</b></td>\n </tr>\n"; $s1 = 0; $s2 = 0; $s3 = 0; $s4 = 0; $s5 = 0; $s6 = 0; $s7 = 0; $sd1 = 0; $sd2 = 0; $sd3 = 0; $sd4 = 0;
//$dbName = "transatlant_db1"; $_SESSION['hostname'] = $hostname; $_SESSION['dbuser'] = $username; $_SESSION['dbpass'] = $password; $_SESSION['dbname'] = $dbName; mysql_connect($hostname, $username, $password) or die("Can't connect to database."); mysql_select_db($dbName) or die(mysql_error()); $query = "select * from iusers where login='******' and userpass='******'"; $res = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($res); $_SESSION['div_id'] = $row['div_id']; //$_SESSION['div_id']=42; $_SESSION['u_id'] = $row['user_id']; $Userfullname = $row['username']; //echo get_div_name($row['div_id'])."<br>"; $fulldiv = get_div_parent($row['div_id']) . "." . get_div_name($row['div_id']); $divname = get_div_name($row['div_id']); //echo $_SESSION['div_id']."<br>"; //echo $_SESSION['u_id']."<br>"; unset($PHP_AUTH_USER); unset($PHP_AUTH_PW); //echo $PHP_AUTH_PW; ?> <html> <head> <title>IBAG: ”правление складом.</title> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251'> </head>
// echo "{success: false}"; //$rec['username']=iconv("Windows-1251", "UTF-8" , $rec['username']); //onmouseover=\"this.style.backgroundPosition=\'0 -25px\';\" onmouseout=\"this.style.backgroundPosition=\'0 0px\';\" onclick=\"this.style.backgroundPosition=\'0 -25px\';\" require "func.php"; $servicestr = ""; $link = mysql_connect("localhost", "dobro", "bitdobru") or die("Could not connect"); mysql_select_db("dobro_db4") or die("Could not select database"); $sql = "select * from iusers where login='******'first'] . "' and userpass='******'psw'] . "'"; $query = mysql_query($sql) or die("e"); $row = mysql_fetch_array($query); if (mysql_num_rows($query) < 1) { $strerr = utf("Ошибка имени пользователя и пароля"); $str = "false"; } else { $strerr = ""; $strname = "<table cellspacing=2 cellpadding=0 height=22><tbody><tr><td><div><img src=img/user-icon.png></div></td><td><div> </div></td><td><div class=north-panel-div>" . utf(get_div_parent($row['div_id'])) . ". " . utf(get_div_name($row['div_id'])) . ". </div></td><td><div class=north-panel-name>" . utf($row['username']) . "</div></td></tr></tbody></table>"; $user_id = $row['user_id']; $div_id = $row['div_id']; $str = "true"; } $queryservice = "select * from services order by id"; $resultservice = mysql_query($queryservice) or die("er service11111"); $i = 0; $servicestr = "<table cellspacing=6 cellpadding=0><tbody><tr>"; $servicestr = $servicestr . "<td><div id=userlist_act class=button-home> </div></td>"; while ($rowserv = mysql_fetch_array($resultservice)) { $servicestr = $servicestr . "<td><div id=service_act_" . $i . " class=button-" . utf($rowserv['serviceprefix']) . " ></div></td>"; $i++; } // while $servicestr = $servicestr . "</tr></tbody></table>";
<?php require "func.php"; $servicestr = ""; $link = mysql_connect("localhost", "dobro", "bitdobru") or die("Could not connect"); mysql_select_db("dobro_db1") or die("Could not select database"); $sql = "select * from iusers where login='******'first'] . "' and userpass='******'psw'] . "'"; $query = mysql_query($sql) or die("e"); $row = mysql_fetch_array($query); if (mysql_num_rows($query) < 1) { $strerr = "Ошибка имени пользователя или пароля"; $str = "false"; } else { $strerr = ""; $strname = "<table cellspacing=2 cellpadding=0 height=22><tbody><tr><td><div><img src=img/user-icon.png></div></td><td><div> </div></td><td><div class=north-panel-div>" . utf(get_div_parent($row['div_id'])) . " " . utf(get_div_name($row['div_id'])) . ". </div></td><td><div class=north-panel-name>" . utf($row['username']) . " <b><span style=\\'font-size: 14px;\\'>[" . $row['login'] . "]</span></b></div></td></tr></tbody></table>"; $user_id = $row['user_id']; $div_id = $row['div_id']; $igroup = $row['igroup']; $str = "true"; } $_SESSION['user_id'] = $user_id; if ($str == "true") { $queryservice = "select s.id, s.parent_id, s.serviceprefix, s.servicename, s.url from services s, userservices us\n where s.id=us.service_id and us.user_id={$user_id} order by s.parent_id, s.id "; $resultservice = mysql_query($queryservice) or die("er service11111"); $i = 0; $servicestr = "<table cellspacing=6 cellpadding=0><tbody><tr>"; $servicestr = $servicestr . "<td><div id=userlist_act class=button-home> </div></td>"; while ($rowserv = mysql_fetch_array($resultservice)) { $rowserv['id'] = $rowserv['id']; $rowserv['parent_id'] = $rowserv['parent_id']; $rowserv['serviceprefix'] = $rowserv['serviceprefix']; $rowserv['servicename'] = utf($rowserv['servicename']);
reset($ch); $query = "select letters.div_id, {$dbname}.div.divname,sum(letsum)\n\t \t\tfrom letters, {$dbname}.div\n\t where letters.div_id={$dbname}.div.div_id and letters.let_id in("; $query1 = ""; while (list($index, $value) = each($ch)) { $query1 .= "{$value},"; $query .= "{$value},"; } $query = substr($query, 0, -1); $query1 = substr($query1, 0, -1); $query .= ") group by div_id"; reset($ch); $result = mysql_query($query) or die(mysql_error("Ошибка запроса")); while (list($div_id, $divname, $sum) = mysql_fetch_row($result)) { $total_summ = $sum; $total_summ_all += $sum; $s1 = get_div_parent($div_id); $str3 = number_format($sum, 2, '.', ' '); echo "\n <tr>\n <td class='total_oper_text' valign=center width=50% align=right>\n {$s1}.<b>{$divname}</b>\n </td>\n <td class='total_oper_text'>\n <table width=100% border=0 cellspacing=0 cellpadding=2>\n <tr>\n <td class='let_list_data' style='BORDER: 0px solid;font-size=7pt;color:#888888' align=right valign=center width=15% align=left>\n сумма\n </td>\n <td class='let_list_data' style='BORDER: 0px solid;font-size=8pt;color:#990000' valign=center width=15% align=right>\n {$str3}\n </td>\n </tr>"; $query_addsum = "select {$dbname}.div.div_id, {$dbname}.div.divname,total_addsum.last_id,letaddsummtypes.lastname,sum(ltassumm),sum(letsum)\n\t from total_addsum, {$dbname}.div,letters,letaddsummtypes\n\t where {$dbname}.div.div_id=letters.div_id and total_addsum.let_id=letters.let_id and\n letters.let_id in({$query1}) and\n\t total_addsum.last_id=letaddsummtypes.last_id and letters.los_id=1 and letters.div_id={$div_id}\n\t group by letters.div_id,letaddsummtypes.lastname\n\t order by {$dbname}.div.divname"; $res = mysql_query($query_addsum) or die(mysql_error()); $i = 0; while ($row = mysql_fetch_array($res)) { $total_addsum_name[$i] = $row[3]; $total_addsum[$i] += $row[4]; $i++; echo "\n <tr>\n <td class='let_list_data' style='BORDER: 0px solid;font-size=7pt;color:#888888' align=right valign=center width=15% align=left>\n {$row['3']}\n </td>\n <td class='let_list_data' style='BORDER: 0px solid;font-size=8pt;color:#996666' valign=center width=15% align=right>"; $str1 = number_format($row[4], 2, '.', ' '); echo "\n {$str1}\n </td>\n </tr>"; $query_action_sum = "select latname\n\t from letactiontypes,letaddsummtypes\n\t where letactiontypes.lat_id=letaddsummtypes.lat_id and letaddsummtypes.last_id={$row['2']}"; $res_action_sum = mysql_query($query_action_sum) or die(mysql_error()); $num = mysql_num_rows($res_action_sum);
$s3 = 0; $s4 = 0; $s5 = 0; $s6 = 0; $s7 = 0; $sd1 = 0; $sd2 = 0; $sd3 = 0; $sd4 = 0; $sd5 = 0; $sd6 = 0; $sd7 = 0; $query = "SELECT\n sum(p.ibtpos) AS FIELD_1, sum(p.ibtweight) AS FIELD_2, sum(p.ibtvolume) AS FIELD_3,\n sum(p.ibtstrahovka) AS FIELD_4, sum(p.ibttotalsumm) AS FIELD_5, sum(p.ibtsummpaied) AS FIELD_6,\n sum(p.ibtsummdept) AS FIELD_7, t.ibtdestdiv_id\n FROM ibag_transit t, properties p, ibag_movement m, transport tr\n where p.prop_id=m.prop_id and t.ibtbarcode=m.barcode and m.trans_id in {$listibt} and tr.trans_id in {$listibt}\n and m.div_id=tr.sourcediv_id and m.trans_id=tr.trans_id\n group by t.ibtdestdiv_id"; $res3 = mysql_query($query) or die("errro1"); while ($row3 = mysql_fetch_array($res3)) { $sklad = "<font style='font-size:7pt'>" . get_div_parent($row3[7]) . '</font>.<b>' . get_div_name($row3[7]) . "</b>"; /* $query_dest="SELECT sum(p.ibtpos) AS FIELD_1, sum(p.ibtweight) AS FIELD_2, sum(p.ibtvolume) AS FIELD_3, sum(p.ibtstrahovka) AS FIELD_4, sum(p.ibttotalsumm) AS FIELD_5, sum(p.ibtsummpaied) AS FIELD_6, sum(p.ibtsummdept) AS FIELD_7 FROM ibag_transit t, properties p, ibag_movement m, transport tr where p.prop_id=m.prop_id and t.ibtbarcode=m.barcode and m.trans_id in $listibt and tr.trans_id in $listibt and m.div_id=tr.sourcediv_id and m.trans_id=tr.trans_id and t.ibtdestdiv_id=$row3[7]"; $res_dest = mysql_query($query_dest) or die("error2"); $row_dest = mysql_fetch_row($res_dest);*/ if ($row3[6] == 0) { $rowcolor = '#FFFFFF'; } else { $rowcolor = '#FFE1E1';
/* echo "<table class='let_list_data' width='100%' border='0' cellspacing='3' cellpadding='0'> <tr> <td width='100%' id='td16' class='otcsubmenu_on' onmouseover=\"change_on(1, 16, 'otcsubmenu');\" onmouseout=\"change_on(0, 16, 'otcsubmenu');\" style='cursor:hand;' onclick='javascript:document.forms[0].cn.value=-1;parent.wsform.submit();'> <b> Îñòàòêè:</b></td> </tr> </table>";*/ $query="select DISTINCT d.parentdiv_id from $dbname.div d, ibag_transit t, ibag_movement m where m.ibt_id=t.ibt_id and d.div_id=t.ibtsourcediv_id and m.div_id=$div"; $res = mysql_query($query) or die("asdfs"); echo "<table width=100% border=0 cellspacing=0 cellpadding=0>"; $tdnum=0; $div=$_SESSION['div_id']; while ($row=mysql_fetch_array($res)) { $tdnum++; $str=" ".get_div_parent($row[0]); $parentdiv=get_div_parent_id($row[0]); $query2="select oiimage from objimages where oiiv_id=$parentdiv"; $res11 = mysql_query($query2) or die(mysql_error()); $row11=mysql_fetch_row($res11); $imgstr="<image valign=middle src='".$row11[0]."' border=0>"; mysql_free_result($res11); $query="select sum(p.ibtpos) from ibag_movement m, properties p, ibag_transit t, dobro_db1.div d where m.barcode=t.ibtbarcode and m.prop_id=p.prop_id and m.div_id=$div and t.ibtsourcediv_id=d.div_id and d.mainparent_id=$parentdiv and m.operstate=2"; $res = mysql_query($query) or die("asdfs"); $row=mysql_fetch_row($res); echo "<tr><td> </td></tr> <td align='center' valign='MIDDLE' colspan='2'>
$query2=$query2.")"; //echo $query2; $result2=mysql_query($query2) or die ("Query failed2"); $row2=mysql_fetch_row($result2); $datastr=explode("-",$m2); $strdate=$datastr[2].".".$datastr[1].".".$datastr[0]; $i++; if ($i%2==0) { $classtr='let_list_data'; } else{$classtr='let_list_fixed';} $str=get_div_parent($m1); print "<tr height='20' >"; echo "<td class =$classtr >"; print "<table width=100% border='0' cellpadding='1' cellspacing='0' > <tr><td ondblclick=f1_click($m1,'$strdate');><b><font color='#000000' face='tahoma' size='2'> $strdate</font></b> <font color='#800000' face='tahoma' size='2'>".$str."</font></td></tr> <tr><td colspan='2' ondblclick=f1_click($m1,'$strdate');><font color='#000000' face='tahoma' size='2'> Количество мест:</font> <b><font color='#008000' face='tahoma' size='2'>".$row2[0]."</font></b></td></tr> </table> </td>"; print "<td valign=center width='25pt' class =$classtr> <table width=100% height=100% border='0' cellpadding='0'> <tr><td align=center valign=middle style='cursor:hand' onclick=f_click($m1,'$strdate','$row2[0]');> <img src='images/sender.gif'><br><font class='fonts1'> загрузить</font> </td></tr></table> </td>";
$total_sum += $div_sum; $total_persum += $div_persum; $total_totalsum += $div_totalsum; } $str .= "<TR>" . "<TD align='left' class='main_oper_list_cap' style='font-weight:bold'>ИТОГО" . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_sum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_persum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_totalsum, 2, '.', ' ') . "</TD>" . "</TR>" . "</TABLE>"; /***************************************************КОНЕЦ КРЕДИТОРОВ********************************************************/ /***************************************************РЕГИОНЫ*****************************************************************/ $str1 = "<TABLE border='0' cellpadding='0' cellspacing='1'>" . "<TR>" . "<TD colspan='4'>" . "<TABLE width='100%' border='0' cellpadding='0' cellspacing='1' class='main_oper_list_cap'>" . "<TR>" . "<TD align='right' style='font-weight:bold'>ИТОГОВЫЕ СУММЫ НА РЕГИОНЫ" . "</TD>" . "</TR>" . "</TABLE>" . "</TD>" . "</TR>" . "<TR align='center'>" . "<TD class='let_list_data'><b>КУДА</b></TD>" . "<TD class='let_list_data'><b>СУММА</b></TD>" . "<TD class='let_list_data'><b>%</b></TD>" . "<TD class='let_list_data'><b>СУММА+%</b></TD>" . "</TR>"; $query_sum_region = "SELECT SUM(c.creditsum),SUM(c.creditpersum),SUM(c.debt-c.appoint), d.div_id,divname\rFROM credits c, `div` d\rWHERE d.div_id=c.destdiv_id\rAND c.los_id IN('3','7','8') GROUP BY c.destdiv_id"; //Запрос с группировкой сумм $res_sum = mysql_query($query_sum_region) or die("<script>alert('ОШИБКА ЗАПРОСА');</script>"); $total_sum = 0; $total_persum = 0; $total_totalsum = 0; while (list($div_sum, $div_persum, $div_totalsum, $div_id, $divname) = mysql_fetch_row($res_sum)) { $str1 .= "<TR>" . "<TD align='right' class='let_list_data'>" . get_div_parent($div_id) . ".<B>" . $divname . "</B>" . "</TD>" . "<TD align='right' class='let_list_data' style='color:maroon'>" . number_format($div_sum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='let_list_data' style='color:maroon'>" . number_format($div_persum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='let_list_data' style='color:maroon'>" . number_format($div_totalsum, 2, '.', ' ') . "</TD>" . "</TR>"; $total_sum += $div_sum; $total_persum += $div_persum; $total_totalsum += $div_totalsum; } $str1 .= "<TR>" . "<TD align='left' class='main_oper_list_cap' style='font-weight:bold'>ИТОГО" . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_sum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_persum, 2, '.', ' ') . "</TD>" . "<TD align='right' class='main_oper_list_cap' style='color:maroon;font-weight:bold'>" . number_format($total_totalsum, 2, '.', ' ') . "</TD>" . "</TR>" . "</TABLE>"; /***************************************************КОНЕЦ РЕГИОНОВ**********************************************************/ echo "<SCRIPT DEFER>\rparent.divteg.innerHTML=\"" . $str . "\";\rparent.divteg1.innerHTML=\"" . $str1 . "\";\r</SCRIPT>"; /***************************************************Конец вставки в родительский документ***********************************/ $query_destdiv = "SELECT DISTINCT d.divname,c.destdiv_id\rFROM credits c,`div` d\rWHERE c.los_id IN('3','7','8')\rAND d.div_id=c.destdiv_id\rORDER BY d.divname COLLATE latin1_general_ci"; $res_destdiv = mysql_query($query_destdiv) or die("<script>alert('ОШИБКА ЗАПРОСА');</script>"); if (mysql_num_rows($res_destdiv) > 0) { $counter = 1; //echo "<FORM name='curcredits' target='_parent' action='../../ws.php' method='post' style='margin:0px; padding:0px'>"; //echo "<input name='wsdoc' type='hidden' value=''>"; echo "<input name='operate' type='hidden' value=''>";