| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod Download ( |
| | | MacroPlan macroPlan |
| | | MacroPlan macroPlan, |
| | | Factorys factorys, |
| | | ProductGenerations generations, |
| | | ProductPowers powers, |
| | | ProductMLBMQBs mlbmqls, |
| | | InventorySummarySearch search |
| | | ) as BinaryValue |
| | | { |
| | | Description: '下载财务报表数据' |
| | |
| | | xmlDOM := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' ); |
| | | |
| | | tableElement := xmlDOM.GetElementByTagName( "table", 0 ); |
| | | //Search |
| | | searchcolumnelement := xmlDOM.CreateElement( "column" ); |
| | | searchnameelement := xmlDOM.CreateElement( "name" ); |
| | | searchtypeelement := xmlDOM.CreateElement( "type" ); |
| | | searchnameelement.TextContent( 'Search' ); |
| | | searchtypeelement.TextContent( "String" ); |
| | | searchcolumnelement.AppendChild( searchnameelement ); |
| | | searchcolumnelement.AppendChild( searchtypeelement ); |
| | | //Product |
| | | productcolumnelement := xmlDOM.CreateElement( "column" ); |
| | | productnameelement := xmlDOM.CreateElement( "name" ); |
| | |
| | | attricolumnelement.AppendChild( attrinameelement ); |
| | | attricolumnelement.AppendChild( attritypeelement ); |
| | | |
| | | tableElement.AppendChild( searchcolumnelement ); |
| | | tableElement.AppendChild( productcolumnelement ); |
| | | tableElement.AppendChild( unitcolumnelement ); |
| | | tableElement.AppendChild( attricolumnelement ); |
| | | searchtotal := factorys.Size() + generations.Size() + powers.Size() + mlbmqls.Size() + 10 ; |
| | | searchunitElement := xmlDOM.CreateElement( "cell" ); |
| | | searchunitElement.SetAttribute( "value", 'Unit' ); |
| | | searchcolumnelement.AppendChild( searchunitElement ); |
| | | traverse( factorys, Elements, factory ){ |
| | | searchunitcellElement := xmlDOM.CreateElement( "cell" ); |
| | | searchunitcellElement.SetAttribute( "value", factory.Name() ); |
| | | searchcolumnelement.AppendChild( searchunitcellElement ); |
| | | } |
| | | searchgenerationElement := xmlDOM.CreateElement( "cell" ); |
| | | searchgenerationElement.SetAttribute( "value", 'Generation' ); |
| | | searchcolumnelement.AppendChild( searchgenerationElement ); |
| | | traverse( generations, Elements, generation ){ |
| | | generationcellElement := xmlDOM.CreateElement( "cell" ); |
| | | generationcellElement.SetAttribute( "value", generation.Generation() ); |
| | | searchcolumnelement.AppendChild( generationcellElement ); |
| | | } |
| | | searchpowerElement := xmlDOM.CreateElement( "cell" ); |
| | | searchpowerElement.SetAttribute( "value", 'Power' ); |
| | | searchcolumnelement.AppendChild( searchpowerElement ); |
| | | traverse( powers, Elements, power ){ |
| | | searchpowercellElement := xmlDOM.CreateElement( "cell" ); |
| | | searchpowercellElement.SetAttribute( "value", power.Power() ); |
| | | searchcolumnelement.AppendChild( searchpowercellElement ); |
| | | } |
| | | searchmlbmqlElement := xmlDOM.CreateElement( "cell" ); |
| | | searchmlbmqlElement.SetAttribute( "value", 'MQBMLB' ); |
| | | searchcolumnelement.AppendChild( searchmlbmqlElement ); |
| | | traverse( mlbmqls, Elements, mlbmql ){ |
| | | searchmlbmqlcellElement := xmlDOM.CreateElement( "cell" ); |
| | | searchmlbmqlcellElement.SetAttribute( "value", mlbmql.MLBMQB() ); |
| | | searchcolumnelement.AppendChild( searchmlbmqlcellElement ); |
| | | } |
| | | searchstartdateElement := xmlDOM.CreateElement( "cell" ); |
| | | searchstartdateElement.SetAttribute( "value", 'Start date' ); |
| | | searchcolumnelement.AppendChild( searchstartdateElement ); |
| | | searchstartdatecellElement := xmlDOM.CreateElement( "cell" ); |
| | | searchstartdatecellElement.SetAttribute( "value", search.StartDate().Format( 'M2/D2/Y' ) ); |
| | | searchcolumnelement.AppendChild( searchstartdatecellElement ); |
| | | searchenddateElement := xmlDOM.CreateElement( "cell" ); |
| | | searchenddateElement.SetAttribute( "value", 'End date' ); |
| | | searchcolumnelement.AppendChild( searchenddateElement ); |
| | | searchenddatecellElement := xmlDOM.CreateElement( "cell" ); |
| | | searchenddatecellElement.SetAttribute( "value", search.EndDate().Format( 'M2/D2/Y' ) ); |
| | | searchcolumnelement.AppendChild( searchenddatecellElement ); |
| | | searchcellElement1 := xmlDOM.CreateElement( "cell" ); |
| | | searchcellElement1.SetAttribute( "value", 'Periods' ); |
| | | searchcolumnelement.AppendChild( searchcellElement1 ); |
| | | searchcellElement1 := xmlDOM.CreateElement( "cell" ); |
| | | searchcellElement1.SetAttribute( "value", search.Category() ); |
| | | searchcolumnelement.AppendChild( searchcellElement1 ); |
| | | traverse ( table, InventorySummaryColumn, column ) { |
| | | columnelement := xmlDOM.CreateElement( "column" ); |
| | | nameelement := xmlDOM.CreateElement( "name" ); |
| | |
| | | avecellElement := xmlDOM.CreateElement( "cell" ); |
| | | avecellElement.SetAttribute( "value", '平均库存' );//AverageInventory |
| | | attricolumnelement.AppendChild( avecellElement ); |
| | | |
| | | if( cells.Size() > searchtotal ){ |
| | | for( i := searchtotal; i < cells.Size(); i := i + 1 ){ |
| | | searchcellElement1 := xmlDOM.CreateElement( "cell" ); |
| | | searchcellElement1.SetAttribute( "value", '' ); |
| | | searchcolumnelement.AppendChild( searchcellElement1 ); |
| | | } |
| | | } |
| | | } |
| | | //期末库存 |
| | | endcellElement := xmlDOM.CreateElement( "cell" ); |
| | |
| | | avecellElement.SetAttribute( "value", [String]c.AverageInventory() ); |
| | | columnelement.AppendChild( avecellElement ); |
| | | } |
| | | if( cells.Size() < searchtotal ){ |
| | | for( i := cells.Size(); i < searchtotal; i := i + 1 ){ |
| | | searchcellElement1 := xmlDOM.CreateElement( "cell" ); |
| | | searchcellElement1.SetAttribute( "value", '' ); |
| | | searchcolumnelement.AppendChild( searchcellElement1 ); |
| | | } |
| | | } |
| | | tableElement.AppendChild( columnelement ); |
| | | } |
| | | |