Thursday, 24 March 2016

SSRS Reports

SalesRegister:




ClassDeclaration:

[SRSReportQueryAttribute (querystr(SalesRegisterQueryMT)), //My Query
SRSReportParameterAttribute(classStr(SSrsRdpContractSales))] //class name
//class SSrsSalesReqRDP extends SRSReportDataProviderBase
class SSrsSalesReqRDP extends SrsReportDataProviderPreProcess
{
    SalesReqTmp      salesReqTmp;
    InventDim           inventDim;
    CustInvoiceTrans    custInvoiceTrans;
    CustInvoiceJour     custInvoiceJour;
    SalesTable          salesTable;
    CustPackingSlipJour custPackingSlipJour;
    CustTable           custTable;
    SalesLine           salesLine;
    TaxTrans            taxTrans;
    MarkupTrans         markupTrans;
    DirPartyTable       dirPartyTable;
    InventTable         inventTable;
    UnitOfMeasureConversion  unitOfMeasureConversion;
    EcoResProduct       ecoResProduct;
    LogisticsPostalAddress logisticsPostalAddress;
}

AmountCur:

public TaxRegulationAmountCur amountCur(TaxTrans _taxTrans)
{
    return _taxTrans.SourceRegulateAmountCur * -1;

}

displaySourceRegulateAmountCur:

public TaxRegulationAmountCur displaySourceRegulateAmountCur(TaxTrans _taxTrans)
{
    return _taxTrans.SourceRegulateAmountCur * 1;
}

getSalesReqTmp:

[SRSReportDataSetAttribute("SalesReqTmp")] //tmp table
Public SalesReqTmp getSalesReqTmp()
{
    select * from salesReqTmp;

    return salesReqTmp;
}

insertTmpTable:

public void insertTmpTable()
{
    CustInvoiceTrans    custInvoiceTransLoc;
    MarkupTrans         markuptransLoc;

    salesTable = salesTable::find(custInvoiceTrans.SalesId);
    custPackingSlipJour = custPackingSlipJour::findFromSalesId(salesTable.SalesId);
   // custPackingSlipJour = custPackingSlipJour::findFromCustPackingSlipTrans();
    custInvoiceJour = custInvoiceJour::findFromCustInvoiceTrans(custInvoiceTrans.SalesId,custInvoiceTrans.InvoiceId,custInvoiceTrans.InvoiceDate,custInvoiceTrans.numberSequenceGroup);
    custTable = custTable::find(custInvoiceJour.InvoiceAccount);
    salesLine = salesLine::findItemIdInventDimId(custInvoiceTrans.SalesId,custInvoiceTrans.ItemId,custInvoiceTrans.InventDimId);
    //taxTrans = Taxtrans::find(custInvoiceJour.LedgerVoucher, custInvoiceJour.InvoiceDate);
    //suresh:moldtek   second modification for finance people
    select * from dirPartyTable
        where dirPartyTable.RecId == custTable.Party;

    select * from inventTable
        where inventTable.ItemId == salesLine.ItemId;
    ecoResProduct   =   EcoResProduct::find(inventTable.Product);

    select * from unitOfMeasureConversion
        where unitOfMeasureConversion.Product == ecoResProduct.RecId;

    if(unitOfMeasureConversion.Factor)
    salesReqTmp.Factor          =   custInvoiceTrans.Qty / unitOfMeasureConversion.Factor;
    salesReqTmp.ItemBuyerGroupId =  inventTable.ItemBuyerGroupId;
    //**********
    select markuptransLoc
        where markuptransLoc.TransTableId == custInvoiceTrans.TableId
        && markuptransLoc.TransRecId == custInvoiceTrans.RecId;

    salesReqTmp.FrieghtValue = custInvoiceTrans.Qty * markuptransLoc.Value;//  _custInvoiceJour.SumMarkup;

    //salesReqTmp.FrieghtValue    =   custInvoiceJour.SumMarkup;
    salesReqTmp.County          =   custTable.countyName();
    salesReqTmp.MTCustECCNo     =   custInvoiceJour.EccNo();
    salesReqTmp.MTCustTINNo     =   custInvoiceJour.CustTinNo();
    salesReqTmp.MTName          =   dirPartyTable.Name;
    salesReqTmp.CustGroup       =   custTable.CustGroup;
    //suresh:moldtek   second modification for finance people
    salesReqTmp.InventSiteId     =   inventDim.InventSiteId;
    salesReqTmp.SalesId          =   custInvoiceTrans.SalesId;
    //salesReqTmp.salesTableCreateDattime  =   salesTable.createdDateTime;
    salesReqTmp.InvoiceAccount   =   custInvoiceTrans.InvoiceId;
    salesReqTmp.PackingSlipId    =   custPackingSlipJour.PackingSlipId;
    salesReqTmp.DeliveryDate     =   custPackingSlipJour.DeliveryDate;
    salesReqTmp.InvoiceId        =   custInvoiceTrans.InvoiceId;
    salesReqTmp.InvoiceDate      =   custInvoiceJour.InvoiceDate;
    salesReqTmp.InvoiceAccount   =   custInvoiceJour.InvoiceAccount;
    salesReqTmp.Name             =   salesTable.SalesName;
    //salesReqTmp.LocationOfcustor =   custTable.addressCounty();
    salesReqTmp.AccountNum       =   custTable.AccountNum;
    salesReqTmp.PaymTermId       =   custTable.PaymTermId;
    salesReqTmp.RegistrationNumber = salesTable.eccNum();
    salesReqTmp.SODate           =   salesTable.MTcreateDate();
    salesReqTmp.SalesName        =   salesTable.SalesName;
    salesReqTmp.PurchaseOrder    =   custInvoiceJour.PurchaseOrder;
    salesReqTmp.PODate           =   salesTable.PODate;
    salesReqTmp.TaxGroup         =   salesLine.TaxGroup;
    salesReqTmp.ItemId           =   salesLine.ItemId;
    salesReqTmp.itemName         =   salesLine.Name;
    salesReqTmp.ItemGroupId      =   InventItemGroupItem::findByItemIdLegalEntity(salesLine.ItemId).ItemGroupId;
    salesReqTmp.InventSizeId     =   inventDim.InventSizeId;
    salesReqTmp.Qty              =   custInvoiceTrans.Qty;
    salesReqTmp.SalesUnit        =   custInvoiceTrans.SalesUnit;
    salesReqTmp.CurrencyCode     =   custInvoiceTrans.CurrencyCode;
    salesReqTmp.SalesPrice       =   custInvoiceTrans.SalesPrice;
    salesReqTmp.LineAmount       =   custInvoiceTrans.lineAmountInclTax();
    salesReqTmp.ConsigneeLocation   =   LogisticsPostalAddress::findRecId(salesLine.DeliveryPostalAddress).County;


    taxTrans.clear();
    salesReqTmp.BEDTaxCode      =   "";
    salesReqTmp.BedAmount      =   0;
    salesReqTmp.EcessTaxCode    =   "";
    salesReqTmp.ECessAmount     =   0;
    salesReqTmp.SHECessTaxCode  =   "";
    salesReqTmp.SHECessAmount   =   0;
    salesReqTmp.VATTaxCode      =   "";
    salesReqTmp.VATAmount      =   0;
    salesReqTmp.CSTTaxcode      =   "";
    salesReqTmp.CSTTaxAmount    =   0;
    salesReqTmp.EDTaxCode      =   "";
    salesReqTmp.EDAmount      =   0;
    salesReqTmp.OctroiTaxCode      =   "";
    salesReqTmp.OctroiAmount      =   0;





        while select taxTrans
            where taxTrans.Voucher == custInvoiceJour.LedgerVoucher
            && taxTrans.InventTransId   ==  custInvoiceTrans.InventTransId
        {
            if(taxTrans.TaxCode like "BED*")
            {
                salesReqTmp.BEDTaxCode    =   taxTrans.TaxCode;
                salesReqTmp.BedAmount     =   this.amountCur(taxTrans);
            }
            //Moldtek added by Suresh 08-03-2015 start
            if(taxTrans.TaxCode like "ED*")
            {
                salesReqTmp.EDTaxCode    =   taxTrans.TaxCode;
                salesReqTmp.EDAmount     =   this.amountCur(taxTrans);
            }

            if(taxTrans.TaxCode like "Octroi*")
            {
                salesReqTmp.OctroiTaxCode   =   taxTrans.TaxCode;
                salesReqTmp.OctroiAmount    =   this.amountCur(taxTrans);
            }
            //Moldtek added by Suresh 08-03-2015 end
            if(taxTrans.TaxCode like "ECESS*")
            {
                salesReqTmp.EcessTaxCode    =   taxTrans.TaxCode;
                salesReqTmp.ECessAmount     =   this.amountCur(taxTrans);
            }
            if(taxTrans.TaxCode like "SHECESS*")
            {
                salesReqTmp.SHECessTaxCode    =   taxTrans.TaxCode;
                salesReqTmp.SHECessAmount     =   this.amountCur(taxTrans);
            }
            if(taxTrans.TaxCode like "VAT*")
            {
                salesReqTmp.VATTaxCode    =   taxTrans.TaxCode;
                salesReqTmp.VATAmount     =   this.amountCur(taxTrans);
            }
            if(taxTrans.TaxCode like "CST*")
            {
                salesReqTmp.CSTTaxcode    =   taxTrans.TaxCode;
                salesReqTmp.CSTTaxAmount     =   this.amountCur(Taxtrans);
            }
        }


    salesReqTmp.insert();
}

processReport:

[SysEntryPointAttribute(false)]
public void processReport()
{
    QueryRun                    queryRun;
    Query                       query;// = new Query();

    // Get the query from the runtime using a dynamic query.

    delete_from salesReqTmp;

    query = this.parmQuery();
    queryRun    = new QueryRun(query);
    ttsbegin;
    while (queryRun.next())
    {

        inventDim = queryRun.get(tableNum(InventDim));
       custInvoiceTrans = queryRun.get(tableNum(custInvoiceTrans));

          this.insertTmpTable();

    }
    ttsCommit;

}

SSrsRdpContractSales:

[DataContractAttribute]
class SSrsRdpContractSales
{
   TransDate fromDate;
}
 

PurchaseRegister