Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Download (
|
MacroPlan macroPlan
|
) as BinaryValue
|
{
|
Description: '下载财务报表数据'
|
TextBody:
|
[*
|
|
table := selectobject( macroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
|
|
xmlDOMI := XMLDOMImplementation::Create();
|
xmlDOM := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
|
|
tableElement := xmlDOM.GetElementByTagName( "table", 0 );
|
//Factory
|
searchunitcolumn := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'Unit' );
|
//Generation
|
generationcolumn := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'Generation' );
|
//Power
|
powercolumn := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'Power' );
|
//MLBMQBS
|
mlbmqbcolumn := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'MLBMQB' );
|
//Product
|
productcolumnelement := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'Product' );
|
//Unit
|
unitcolumnelement := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, 'Unit' );
|
|
minindex := min( table, FinancialSalesColumn, column, column.Index() );
|
traverse ( table, FinancialSalesColumn, column ) {
|
columnelement := InventorySummarySource::CreateColumnElement( tableElement, xmlDOM, column.Name() );
|
|
cells := selectsortedset( column, FinancialSalesCell, cell, cell.FinancialSalesRow().RowNr() );
|
|
traverse ( cells, Elements, c ) {
|
if( column.Index() = minindex ){
|
row := c.FinancialSalesRow();
|
//Factory
|
InventorySummarySource::CreateCellElement( xmlDOM, searchunitcolumn, row.Factory() );
|
if( not isnull( row.Product_MP() ) ){
|
//Generation
|
InventorySummarySource::CreateCellElement( xmlDOM, generationcolumn, row.Product_MP().Generation() );
|
//Power
|
InventorySummarySource::CreateCellElement( xmlDOM, powercolumn, row.Product_MP().Power() );
|
//MLBMQBS
|
InventorySummarySource::CreateCellElement( xmlDOM, mlbmqbcolumn, row.Product_MP().MQBMLB() );
|
}else{
|
//Generation
|
InventorySummarySource::CreateCellElement( xmlDOM, generationcolumn, '' );
|
//Power
|
InventorySummarySource::CreateCellElement( xmlDOM, powercolumn, '' );
|
//MLBMQBS
|
InventorySummarySource::CreateCellElement( xmlDOM, mlbmqbcolumn, '' );
|
}
|
//Product
|
InventorySummarySource::CreateCellElement( xmlDOM, productcolumnelement, row.Name() );
|
//Unit
|
InventorySummarySource::CreateCellElement( xmlDOM, unitcolumnelement, row.Unit() );
|
}
|
InventorySummarySource::CreateCellElement( xmlDOM, columnelement, c.Value() );
|
}
|
tableElement.AppendChild( columnelement );
|
}
|
|
xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM );
|
|
tableGroupHandle := TableGroupHandle::Create( FinancialSalesReport::GetDefaultName() );
|
tableHandle := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
|
tableGroupHandle.Add( tableHandle );
|
|
binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
|
|
return binaryData.AsBinaryValue();
|
*]
|
}
|