<?php

require_once "functions.php";
session_start();
security::redirect_if_not_loggedin();
$Guid = costant::desktop_guid();
if (isset($_GET["DeleteAttach"])) {
    attachments::delete_attachment_by_name($_GET["DeleteAttach"]);
}
if (isset($_FILES['UploadedAttachments']) && isset($_POST["Attachment_TrId"])) {
    $TrNumber = (int) $_POST['Attachment_TrId'];
    $FileName = $_FILES['UploadedAttachments']['name'];
    $FileExtension = substr($FileName, strpos($FileName, ".") + 1, strlen($FileName));
    $NewFileName = "Transaction_" . $TrNumber . "_Attach" . (attachments::get_number_of_attachments($TrNumber) + 1) . "." . $FileExtension;
    move_uploaded_file($_FILES['UploadedAttachments']['tmp_name'], "attachments/" . $NewFileName);
    echo $NewFileName;
}
if (isset($_GET["AttachmentsTable"])) {
    $TrId = $_GET["AttachmentsTable"];
    $Attachments = attachments::get_attachments_filename_array($TrId, true);
    echo "<table class = 'table'>";
    echo "<tbody>";
    for ($i = 0; $i < sizeof($Attachments); $i++) {
        echo "<tr>";
        $File = $Attachments[$i];
        design::table_cell(substr($File, strpos($File, "Attach"), strlen($File)), "");
        design::table_cell("<a href='services.php?guid={$Guid}&download_attachment={$File}'>\n                            <span class='glyphicon glyphicon-download-alt'> </span> Open</a>", "text_align_right");
        design::table_cell("<a href='#' onclick='attachment_delete(\"{$File}\",{$TrId});return false;'>\n                            <span class='glyphicon glyphicon-remove'> </span> Delete</a>", "text_align_right");
        echo "</tr>";
    }
    echo "</tbody>";
Example #2
0
             design::table_cell("<span data-toggle='tooltip' title='Subcategory: {$TrSubCategoryShow}' id='tooltip_category_{$lineid}'>{$TrCategoryShow}*</span>", "");
         } else {
             if (costant::disable_category() == False) {
                 design::table_cell($TrCategoryShow, "");
             }
         }
         //AMOUNT
         $TrAmountShow = number_format($resultarray[$i]["Amount"], 2, ",", "");
         design::table_cell($TrAmountShow, "text_align_right td_size_5");
         //NOTES
         $TrNotesShow = $resultarray[$i]["Notes"];
         $NotesHTMLCode = "";
         if ($TrNotesShow != "" && $TrNotesShow != "None") {
             $NotesHTMLCode .= "<span class='glyphicon glyphicon-info-sign' data-toggle='tooltip' title='{$TrNotesShow}' id='tooltip_notes_{$lineid}'></span> ";
         }
         if (attachments::get_number_of_attachments($lineid) > 0) {
             $NotesHTMLCode .= "<span class='glyphicon glyphicon-paperclip'></span>";
         }
         design::table_cell($NotesHTMLCode, "text_align_center");
         //DELETE
         echo "<td class ='text_align_center'>";
         echo "<input type='checkbox' name='TrDelete[]' value='{$lineid}' />";
         echo "</td>";
         //EDIT
         echo "<td class ='text_align_center'>";
         echo "<input type='radio' name='TrEdit[]' value='{$lineid}' />";
         echo "</td>";
         echo "</tr>";
     }
 }
 echo "</tbody>";