var getMonth=require("./getMonth");
module.exports=(async (wb,toparsedate)=>{
    var sheet = wb.getWorksheet(1);
    var insertrows=[];
    if(!sheet){
        return [];
    }
    sheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
        if(toparsedate.isparsedate && rowNumber==3){
            row.eachCell({ includeEmpty: true }, function(cell, colNumber) {
                if(colNumber==1){
                    //var tt=cell.value.richText[0].text;
                    var rptDate=getMonth("SA",cell);
                    toparsedate.rptDate=rptDate;
                }
            });
        }
        if(rowNumber>=5 && rowNumber<=36){
          row.eachCell({ includeEmpty: true }, function(cell, colNumber) {
       
                 if(colNumber==1){
                      desc="资产/"+cell.value.replace(" ","");
                 
                 }
                 if(colNumber==3 || colNumber==4){
                     if(desc!="资产/"){
                          var buildRow={};
                          buildRow.rpttypecode="SA";
                          buildRow.valstr=cell.value?(typeof cell.value=="object"?cell.value.result:cell.value):"0";
                          if(colNumber==3){
                              buildRow.desc=desc+"/期末余额";
                              buildRow.position=rowNumber+"-"+1;
                          }else{
                              buildRow.desc=desc+"/年初余额";
                              buildRow.position=rowNumber+"-"+2;
                          }
                          insertrows.push(buildRow);
                     }
                 }
                 if(colNumber==5){
                     desc="负债和所有者权益/"+cell.value.replace(" ","");
                 }
                 if(colNumber==7 || colNumber==8){
                  if(desc!="负债和所有者权益/"){
                       buildRow={};
                       buildRow.rpttypecode="SA";
                       buildRow.valstr=cell.value?(typeof cell.value=="object"?cell.value.result:cell.value):"0";
                       if(colNumber==7){
                          buildRow.desc=desc+"/期末余额";
                           buildRow.position=rowNumber+"-"+3;
                       }else{
                           buildRow.desc=desc+"/年初余额";
                           buildRow.position=rowNumber+"-"+4;
                       }
                       insertrows.push(buildRow);
                  }
              }
            });
        }
    });
   return insertrows;
  });