#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие файла
if (!GetUploadedFileSize('Invoices', $Invoice['ID'])) {
    return new gException('INVOICE_NOT_BUILDED', 'Счёт не сформирован');
}
#-------------------------------------------------------------------------------
$File = GetUploadedFile('Invoices', $Invoice['ID']);
#-------------------------------------------------------------------------------
$Document = new DOM($File['Data']);
#-------------------------------------------------------------------------------
$Document->Delete('Logo');
#-------------------------------------------------------------------------------
$Document->Delete('Rubbish');
#-------------------------------------------------------------------------------
$Document->DeleteIDs();
#-------------------------------------------------------------------------------
$Div = new Tag('DIV', array('class' => 'Standard', 'style' => 'max-width:700px;'), $Document->Object);
#-------------------------------------------------------------------------------
if ($IsPayed) {
    #-------------------------------------------------------------------------------
    $DOM->AddText('Title', ' (Оплачен)');
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    if ($PaymentSystem['IsContinuePaying']) {
        #-------------------------------------------------------------------------------
        $Comp = Comp_Load('Form/Input', array('onclick' => "ShowProgress('Вход в платежную систему');form.submit();", 'type' => 'button', 'style' => 'font-size:25px;color:#F07D00;', 'value' => 'Оплатить →'));
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error(500);
        }