$tax_ndfl = round($total * 0.7 * 0.13); // проф вычет с резидентов } else { $tax_ndfl = round($total * 0.3); // проф вычет с нерезидентов } $reward_topay = $total - $tax_ndfl; $sql_encoded = htmlspecialchars("insert into artist_payments (act_number_year, reward_to_pay, tax_ndfl, act_number, artist_id, payment_date, reward, cartoons_sold) values (" . $_year . ", " . $reward_topay . ", " . $tax_ndfl . ", " . $_invoice_number . ", " . $artist['id'] . ", '" . $_year_month . "', " . $total . ", " . $_cartoons_amount . ")", ENT_QUOTES); // pokazh($sql_encoded,"sql_encoded"); echo "<div><form method=post action='#'>\r\n <input type='submit' value='Утвердить' style='background-color:#FF9966;'>\r\n <input type='hidden' name='approve' value='1'>\r\n <input type='hidden' name='sql' value='" . $sql_encoded . "'>\r\n </form></div>"; } // Print acceptance certificate PDF $invoice_date = date('d-m-Y', strtotime('-1 second', strtotime('+1 month', strtotime($_month . '/01/' . $_year . ' 00:00:00')))); $out = fill_invoice($filename_acceptance_certificate_pdf, $_invoice_number, $invoice_date, $artist['name'], $artist['bank_attributes'], $the_list, $total, $count, $contract_period, $artist['contract'], date_format(date_create($artist['contract_date']), 'd-m-Y')); echo "<div><form method=post action='http://cartoonbank.ru/ales/tcpdf/examples/artist_acceptance_certificate.php'>\r\n <input type='submit' value='скачать акт № " . $_invoice_number . " выполненных работ (PDF) '>\r\n <input type='hidden' name='html' value='" . htmlspecialchars($out) . "'>\r\n <input type='hidden' name='filename' value='acceptance_certificate_" . $_invoice_number . "'>\r\n </form></div>"; $out_nostamp = fill_invoice($filename_acceptance_certificate_nostamp_pdf, $_invoice_number, $invoice_date, $artist['name'], $artist['bank_attributes'], $the_list, $total, $count, $contract_period, $artist['contract'], date_format(date_create($artist['contract_date']), 'd-m-Y')); echo "<div><form method=post action='http://cartoonbank.ru/ales/tcpdf/examples/artist_acceptance_certificate.php'>\r\n <input type='submit' value='скачать акт № " . $_invoice_number . " выполненных работ (PDF) без печати'>\r\n <input type='hidden' name='html' value='" . htmlspecialchars($out_nostamp) . "'>\r\n <input type='hidden' name='filename' value='acceptance_certificate_" . $_invoice_number . "'>\r\n </form></div></div>"; $total_all = $total_all + $total; $total = 0; } //if($product_list != null) } // foreach($response as $artist) } //if($response != null) } ?> <div style="padding:6px;background-color:#CCFF99;"> Общая сумма выплаченных авторских в этом месяце: <b><?php echo $total_all; ?>
<td style="padding:2px;text-align:center;">1шт.</td> <td style="padding:2px;text-align:center;">' . $discount_price . '</td> <td style="padding:2px;text-align:center;">' . $discount_price . '</td> </tr>'; $n++; } //foreach($product_list as $sales) // print invoice: //$out = fill_invoice($filename, $_invoice_x_number, $_invoice_date, $product['name'], $product['bank_attributes'], $the_list, $total, $count, $contract_period, $product['contract'],date_format(date_create($product['contract_date']),'d-m-Y')); $out = fill_invoice($filename, "x" . $_invoice_x_number, $_invoice_date, "", "", $the_list, $total, $count, $contract_period, "", $this_date, $_discount); echo "<div id='invoice' style='background: white url(http://cartoonbank.ru/img/mg_stamp.gif) no-repeat; background-size: 21%; background-position: 87% 100%; margin:20px; padding:8px;width: 210mm; border: 1px #D6D6D6 solid; font-size: 11pt;'>"; echo $out; echo "</div>"; send_mail($out); // Print invoice PDF $out = fill_invoice($filename_pdf, "x" . $_invoice_x_number, $_invoice_date, "", "", $the_list, $total, $count, $contract_period, "", $this_date, $_discount); echo "<div style='margin-left:20px;'><form method=post action='http://cartoonbank.ru/ales/tcpdf/examples/ales.php'>\n\t\t\t\t\t<input type='submit' value='скачать счёт в формате PDF для распечатывания' style='padding:8px;background-color:#FFFF99;'>\n\t\t\t\t\t<input type='hidden' name='html' value='" . htmlspecialchars($out) . "'>\n\t\t\t\t\t<input type='hidden' name='filename' value='invoice_" . $_invoice_x_number . "'>\n\t\t\t\t</form></br></br></div>"; $_invoice_x_number = $_invoice_start_number + $customer_number; $customer_number++; function fill_invoice($filename, $invoice_x_number = '', $invoice_date = '', $smi = '', $client_details = '', $product_list = '', $total = '', $count = '', $invoice_period = '', $contract_number = '', $contract_date = '', $_discount = 0) { if ($invoice_x_number == '') { $invoice_x_number = '____'; } $today = getdate(); if ($invoice_date == '') { $invoice_date = $today['mday'] . "." . $today['mon'] . "." . $today['year']; } if ($client_details == '') { $client_details = '<br><br><br>'; }