Beispiel #1
0
$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'>&nbsp {$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>";
        if (!isset($_GET['head'])) {
            echo "\n\t                            <td width=25 class='let_list_fixed' ";
            if (isset($_POST['sub_search'])) {
                echo "style='background-color:{$row['loscolor']}'";
            }
            echo " align=center>";
            if (!isset($_POST['sub_search'])) {
                echo "<input checked type='checkbox' value='" . $row['let_id'] . "' name='ch[]'>";
Beispiel #2
0
function country_sum($query, $flag, $ch)
{
    echo "\n        <td class='main_oper_list' align=center valign=top width=50%>\n            <table width=100% border=0 cellspacing=1 cellpadding=1>\n                <tr>\n                    <td class='main_oper_list' align=center valign=top width=50%>\n                      <table width=100% border=0 cellspacing=2 cellpadding=0>";
    $total = 0;
    $total_all = 0;
    $sum = 0;
    $total_addsum = array_fill(0, 20, 0);
    $total_addsum_name = array_fill(0, 20, "");
    $itog_total_addsum = array_fill(0, 20, 0);
    $i = 0;
    $result_country = mysql_query($query) or die(mysql_error("Ошибка запроса"));
    while (list($div_id, $divname) = mysql_fetch_row($result_country)) {
        $query = "select let_id,letsum  from letters l where";
        if ($flag == 1) {
            $query .= "  div_id=";
        } elseif ($flag == 2) {
            $query .= "  sourcediv_id=";
        }
        $query .= "{$div_id} ";
        if ($ch != 0) {
            $query .= "and 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 .= ");";
            reset($ch);
        } else {
            if (!isset($_GET['head'])) {
                require "oper/letters/search_add_query_ctrl.php";
            } else {
                require "letters/search_add_query_ctrl.php";
            }
        }
        $res = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($res)) {
            $total_summ = get_full_letter_summ($row['let_id']);
            $total += $total_summ;
            $sum += $row['letsum'];
            $query_addsum = "select last_id,lastname from letaddsummtypes,letactiontypes\n                                    where letaddsummtypes.lat_id=letactiontypes.lat_id  ";
            $res2 = mysql_query($query_addsum) or die(mysql_error());
            while ($row2 = mysql_fetch_array($res2)) {
                $last_summ = get_letter_summ($row2['last_id'], $row['let_id']);
                if ($last_summ != 0) {
                    $total_addsum[$i] += $last_summ;
                    if ($row2['lastname'] != "") {
                        $total_addsum_name[$i] = $row2['lastname'];
                    }
                }
                $i++;
            }
            $i = 0;
        }
        if ($total != 0) {
            $str = number_format($total, 2, '.', ' ');
            $str3 = number_format($sum, 2, '.', ' ');
            $s1 = get_div_parent($div_id);
            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>";
            while (list($index, $value) = each($total_addsum)) {
                if ($value == 0) {
                    break;
                }
                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                                                                {$total_addsum_name[$index]}";
                $itog_total_addsum[$index] += $total_addsum[$index];
                echo "\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($value, 2, '.', ' ');
                echo "\n                                                                {$str1}\n                                                            </td>\n                                                        </tr>";
            }
            reset($total_addsum);
            echo "\n                                            </table>\n                                        </td >\n\n                                    </tr>\n\n\n                        ";
            $total_all += $sum;
            $total_addsum = array_fill(0, 20, 0);
        }
        $total = 0;
        $sum = 0;
    }
    $totalstr = number_format($total_all, 2, '.', ' ');
    echo "\n\n\n\n\n            <tr>\n             <td align=right class='total_oper_text' style='background-color:#EEEEEE' valign=center width=50%>\n              <b>ИТОГО  &nbsp;</b>\n             </td>\n             <td class='total_oper_num' style='background-color:#EEEEEE' valign=center width=50% align=right>\n                <table width=100% border=0 cellspacing=0 cellpadding=2>\n                    ";
    echo "\n                        <tr>\n                          <td class='total_oper_text' style='background-color:#EEEEEE;BORDER: 0px solid;' align=right valign=center width=15% align=left>\n                              к передаче\n                          </td>\n\n                          <td class='total_oper_num' style='background-color:#EEEEEE;BORDER: 0px solid;'  valign=center width=15% align=right>";
    echo "  <b>{$totalstr}</b>\n\n                          </td>\n                      </tr>";
    while (list($index, $value) = each($total_addsum_name)) {
        if ($total_addsum_name[$index] == "") {
            break;
        }
        echo "\n                        <tr>\n                          <td class='total_oper_text' style='background-color:#EEEEEE;BORDER: 0px solid;'  align=right valign=center width=15% align=left>\n                              {$total_addsum_name[$index]}\n                          </td>\n\n                          <td class='total_oper_num'  style='background-color:#EEEEEE;BORDER: 0px solid;' valign=center width=15% align=right>";
        $str1 = number_format($itog_total_addsum[$index], 2, '.', ' ');
        echo " {$str1}\n\n                          </td>\n                      </tr>";
    }
    echo "\n\n                </table>\n             </td>\n            </tr>\n            </table>\n            </td>\n\n            ";
    echo "\n        </tr>\n          <tr><td height=1></td></tr>\n        </table>\n      </td>";
}
Beispiel #3
0
 echo "\n\t                        <table width=100% border";
 if (!isset($_GET['head'])) {
     echo "=0 ";
 }
 echo " cellspacing=1 cellpadding=1>\n\n\n\n\n\t              ";
 $total = 0;
 $total_all = 0;
 $query_country = "select {$dbname}.div.div_id, {$dbname}.div.divname\n\t                          from {$dbname}.div,divext\n\t                          where  {$dbname}.div.div_id=divext.div_id and divext.dl_id=7;";
 $result_country = mysql_query($query_country) or die(mysql_error("ќшибка запроса"));
 while (list($div_id, $divname) = mysql_fetch_row($result_country)) {
     $query = "select  l.let_id\n            \t\t\t\t\tfrom letters l, {$dbname}.div dd, {$dbname}.div sd, clients cl, payee p, iusers u,letoperstate los\n\t\t\t\t\t\t\t\twhere l.user_id=u.user_id and l.client_id=cl.client_id and l.div_id=dd.div_id and\n\t\t\t\t\t\t\t\tl.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'] . " and l.div_id={$div_id}";
     require "search_add_query.php";
     $query .= " order by l.let_id";
     $res = mysql_query($query) or die(mysql_error());
     while ($row = mysql_fetch_array($res)) {
         $total_summ = get_full_letter_summ($row['let_id']);
         $total += $total_summ;
     }
     if ($total != 0) {
         $str = number_format($total, 2, '.', ' ');
         $s1 = get_div_parent($div_id);
         echo "<tr>\n\t                                <td ";
         if (isset($_GET['head'])) {
             echo "colspan=4";
         }
         echo " class='total_oper_text' valign=center width=70% align=right>\n\t                                    {$s1}.<b>{$divname}</b>\n\t                                </td>\n\t                                <td class='total_oper_num' valign=center width=30% align=right>\n\t                                    {$str}\n\t                                </td>\n\t                             </tr>\n\t                            ";
         $total_all += $total;
     }
     $total = 0;
 }
 echo "</table>";