alter view DBA.v_DDSProdagbi as select RedNo=Number(*), N=Invoices.InvoiceNo, Faktura=Invoices.TrueInvoiceNo, Ime=Invoices.Whom, DanN=Invoices.WhomDanNum, Suma=Invoices.GrandTotal, DDS=Invoices.VAT, SumaBezDDS=Invoices.TotalNoVAT, NeoblSuma=Invoices.WithoutVAT, FDate=Invoices.TrueInvoiceDate, TYPE=(Select "Type" from DocTypes where N=4), TypeName=DocTypes.DocName,Sdelka='ÓÑËÓÃÀ', Mask=Invoices.MaskaFaktura from dba.Invoices,dba.DocTypes where Invoices.TrueInvoiceNo <> 0 and ((Invoices.CancelInvoiceNo > 0 and DocTypes.N = 6) or((Invoices.CancelInvoiceNo = 0 or Invoices.CancelInvoiceNo = -1) and DocTypes.N = 4))