function emite() { $this->conn->executa($this->conn->getAll("comandas", "com_id={$this->com_id}", '', 0), true, "com"); $this->nota .= " PIZZARIA IURI\n"; $this->nota .= " TELE-ENTREGA\n\n"; $this->nota .= "Rua Felipe Camarao,237 Centenario\n"; $this->nota .= "Sapiranga - RS\n"; $this->nota .= "_______________________________________________\n"; $this->nota .= "comanda nº {$this->com_id}\t\t"; $this->nota .= strformat($this->conn->com["com_dtcomanda"], "dtbr") . " - " . $this->conn->com["com_hora"] . "\n"; if ($this->conn->com["com_delivery"] == 1) { $this->conn->executa($this->conn->getJoinRecord("comanda_delivery(+)ruas|rua_id=del_ruaid\n\t\t\t (+)bairros|bai_id=del_baiid", "del_comid={$this->com_id}", '', 0), true, "ped"); $this->nota .= "Entregar:\n"; $this->nota .= "_______________________________________________\n"; $this->nota .= RemoveAcentos($this->conn->ped["del_nome"]) . " (" . $this->conn->ped["del_fone"] . ")" . "\n"; $this->nota .= RemoveAcentos($this->conn->ped["rua_nome"]) . " " . $this->conn->ped["del_endnum"] . " "; $this->nota .= RemoveAcentos($this->conn->ped["del_complemento"]) . "\n"; $this->nota .= "_______________________________________________\n"; $this->nota .= "Qtde\t" . str_pad("Item", 20, " ", STR_PAD_RIGHT) . "Valor\t Total\n"; $sql = $this->conn->getJoinRecord("comandas(=)comanda_itens|com_id=cti_comid\n (=)produtos|cti_proid=pro_id", "com_id=" . $this->com_id, '', 0); $rs = $this->conn->executa($sql); $preco_total = 0; while ($ln = $this->conn->fetch_array($rs)) { $total = $ln["cti_qtde"] * $ln["cti_valor"]; $this->nota .= $ln["cti_qtde"] . "\t" . str_pad(strtoupper(RemoveAcentos($ln["pro_nome"])), 20, " ", STR_PAD_RIGHT) . "" . number_format($ln["cti_valor"], 2, ",", ".") . "\t" . number_format($total, 2, ",", ".") . "\n"; if ($ln["cti_obs"] != '') { $this->nota .= "" . RemoveAcentos($ln["cti_obs"]) . "\n"; } $preco_total += $total; } $this->nota .= "\t\t_______________________________\n"; $this->nota .= "\t\tTOTAL \t\t\t\t" . number_format($preco_total, 2, ",", ".") . "\n"; $this->nota .= "_______________________________________________\n"; $this->nota .= "Obrigado pela Preferencia\n\n\n\n\n\n\n\n\n\n\n"; } $arq = fopen("/tmp/" . $this->com_id . ".rec", "w"); fputs($arq, $this->nota); fclose($arq); echo exec("lpr -P impmat /tmp/" . $this->com_id . ".rec"); sleep(2); unlink("/tmp/" . $this->com_id . ".rec"); }
function __construct($alu_id, $db) { $this->db = $db; //$this->db->_DEBUG = 1; $this->db->executa($this->db->getJoinRecord("alunos(=)movalunos|alu_movid=mov_id\n\t\t (+)procedencias|alu_procedid=pro_id\n\t\t (+)ruas|alu_ruaid=rua_id\n\t\t (+)bairros|alu_baiid=bai_id\n\t\t (+)instituicoes|ins_id=mov_insid\n\t\t (+)turmas|tur_id=mov_turid", "alu_id={$alu_id}", "", 0), true, "aluno"); $rscam = $this->db->getAttTable("alunos"); while ($ln = $this->db->fetch_array($rscam)) { $this->{$ln}["attname"] = $this->db->aluno[$ln["attname"]]; } $rsmov = $this->db->getAttTable("movalunos"); while ($ln = $this->db->fetch_array($rsmov)) { $this->{$ln}["attname"] = $this->db->aluno[$ln["attname"]]; } $this->pro_nome = $this->db->aluno["pro_nome"]; $this->bai_descr = $this->db->aluno["bai_descr"]; $this->rua_nome = $this->db->aluno["rua_nome"]; $this->alu_dtnasc = strformat($this->alu_dtnasc, "dtbr"); $this->mov_dtentrada = strformat($this->mov_dtentrada, "dtbr"); $this->ins_nome = $this->db->aluno["ins_nome"]; $this->tur_nome = $this->db->aluno["tur_nome"]; if ($this->mov_turid != null) { if (class_exists(turma)) { $turma = new turma($this->mov_turid, $this->db); } else { require "../libs/classes/classe_turmas.php"; $turma = new turma($this->mov_turid, $this->db); } $this->tur_nome .= " " . $turma->descturma(); $this->tur_tipo = $turma->tur_tipo; } if ($this->alu_id != null) { $this->db->executa($this->db->getAll("histserie", "hse_aluid = " . $this->alu_id, "hse_ano desc limit 1", 0), true, "hse"); } $this->hse_resfim = $this->db->hse["hse_resfim"]; $this->hse_ano = $this->db->hse["hse_ano"]; $this->hse_serie = $this->db->hse["hse_serie"]; }
function ajx_idade($data, $alu_id) { $sql = "select date_part('YEAR', age('" . strformat($data, "dten") . "'::date)) as ano,\n\t date_part('MONTH',age('" . strformat($data, "dten") . "'::date)) as mes"; $rs = @pg_query($sql); $json = new Services_JSON(); $ano = pg_result($rs, 0, "ano"); $mes = pg_result($rs, 0, "mes"); $str = array("ano" => $ano, "mes" => $mes); $str = $json->encode($str); return $str; }
$pdf->SetFont($fonte, "", 12); $pdf->sety(15); $pdf->SetFont($fonte, "b", 12); $pdf->setx(5); $pdf->ln(); $pdf->SetFont($fonte, "", 14); $pdf->setx(5); $pdf->cell(50, 5, "Controle de Entregas", 0, 1); $pdf->line(5, $pdf->GetY(), 290, $pdf->GetY()); $pdf->ln(10); $pdf->setfont($fonte, "B", "14"); $pdf->cell(0, 5, $_GET["dtvenda"], 0, 1, "C"); $pdf->setfillcolor(235); $pdf->SetFont($fonte, "b", 10); $total = $db->entregas["total"]; $sql = " SELECT fun_nome,count(*) as total\n FROM comandas inner join comandaentrega \n on cet_comid = com_id\n inner join funcionarios on fun_id = cet_funid\n WHERE com_dtcomanda = '" . strformat($_GET["dtvenda"], "dten") . "' group by fun_nome order by fun_nome"; $rs = $db->executa($sql); $pdf->cell(140, 5, "Funcionário", "B", 0, "C", 1); $pdf->cell(45, 5, "Qtde", "B", 1, "C", 1); $pdf->SetFont($fonte, "", 10); while ($ln = $db->fetch_array($rs)) { if ($pdf->getY() >= $pdf->h - 15) { $pdf->addpage(); $pdf->SetFont($fonte, "b", 10); $pdf->cell(140, 5, "Funcionário", "B", 0, "C", 1); $pdf->cell(45, 5, "Qtde", "B", 1, "C", 1); $pdf->SetFont($fonte, "", 10); } $pdf->cell(140, 5, $ln["fun_nome"], 1, 0); $pdf->cell(45, 5, $ln["total"], 1, 1); }
} </script> </head> <body bgcolor="<?php echo $_SESSION["bgcolor"]; ?> " onload="winInit();"> <?php $form->MakeForm("form1", "post", "", "", "", true, "Clientes"); $form->Append("<input type='hidden' value='" . $db->dados["cli_id"] . "' name='cli_id'>"); $form->FrmInput("Nome:", "cli_nome", 75, 30, "", 'AE', $db->dados["cli_nome"]); $form->linha(false, true); $form->FrmInput("Fone:", "cli_foneprinc", 15, 10, "", 'E', $db->dados["cli_foneprinc"], ""); $form->linha(false, true); $form->Frmdata("Nascimento:", "cli_dtnasc", '', "", strformat($db->dados["cli_dtnasc"], "dtbr")); $form->linha(false, true); $form->FrmDbConsulta("Endereço:", "ruas", "rua_id", "rua_nome", "fc_ruas.php", "Endereço", true, $db->dados["rua_id"], $db->dados["rua_nome"]); $form->Append("<td><input type='text' value='" . $db->dados["cli_endnum"] . "' class='nnulo' size='5' name='cli_endnum'\n\t\t\t onkeyup='c_maiuscula(this)' maxlenght='10'></td>"); $form->linha(false, true); $form->FrmDbConsulta("Bairro:", "bairros", "bai_id", "bai_descr", "fc_bairros.php", "", true, $db->dados["cli_baiid"], $db->dados["bai_descr"]); $form->linha(false, true); $form->FrmInput("Complemento:", "cli_complemento", 75, 30, "", '', $db->dados["cli_complemento"]); $form->linha(false, true); $form->AbreCelula(''); //$form->FrmButton($btnlabel,$btnacao,"onclick='return chknulo(document.form1);'","submit"); $form->FrmButton($btnlabel, $btnacao, "onclick='return cadastrar()'", "submit"); $form->FechaCelula(); $form->linha(false); if (isset($_GET["aud_id"])) { $form->frmBDel("Excluir", "jur_nprocaudiencia.php?pro_id=" . $_GET["pro_id"], "procaudiencias", "aud_id", $_GET["aud_id"], 1);
$sql1 = "select count(*) as total from comandas\n where com_delivery = 1\n and com_dtcomanda = '" . strformat($_GET["dtvenda"], "dten") . "'"; $db->executa($sql1, true, "entregas"); $total = $db->entregas["total"]; $sql = "SELECT sum(cti_qtde) as total ,pro_nome \n from comandas inner join comanda_itens on com_id = cti_comid \n inner join produtos on pro_id = cti_proid\n where com_dtcomanda = '" . strformat($_GET["dtvenda"], "dten") . "'\n group by pro_nome order by pro_nome"; $rs = $db->executa($sql); $pdf->cell(140, 5, "Produto", "B", 0, "C", 1); $pdf->cell(45, 5, "Qtde", "B", 1, "C", 1); $pdf->SetFont($fonte, "", 10); while ($ln = $db->fetch_array($rs)) { if ($pdf->getY() >= $pdf->h - 15) { $pdf->addpage(); $pdf->SetFont($fonte, "b", 10); $pdf->cell(140, 5, "Produto", "B", 0, "C", 1); $pdf->cell(45, 5, "Qtde", "B", 1, "C", 1); $pdf->SetFont($fonte, "", 10); } $pdf->cell(140, 5, $ln["pro_nome"], 1, 0); $pdf->cell(45, 5, $ln["total"], 1, 1); } $pdf->ln(); $pdf->SetFont($fonte, "b", 14); $pdf->cell(40, 6, "Tele-entregas:", 0, 0); $pdf->SetFont($fonte, "", 15); $pdf->cell(20, 6, $db->entregas["total"], 0, 1); $sqltotal = "select sum(com_vltotal) as total from comandas where com_dtcomanda ='" . strformat($_GET["dtvenda"], "dten") . "'"; $db->executa($sqltotal, true, "tot"); $pdf->SetFont($fonte, "b", 14); $pdf->cell(40, 6, "Valor Total:", 0, 0); $pdf->SetFont($fonte, "", 15); $pdf->cell(20, 6, "R\$ " . number_format($db->tot["total"], 2, ",", "."), 0, 0); $pdf->output();