var getMonth=require("./getMonth");
module.exports=(async (wb,toparsedate)=>{
    var sheet = wb.getWorksheet(1);
    var insertrows=[];
    sheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
        if(toparsedate.isparsedate && rowNumber==3){
            row.eachCell({ includeEmpty: true }, function(cell, colNumber) {
                if(colNumber==1){
                    console.log("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
                    console.log(toparsedate.fp);
                    console.log(cell.value);
                   // var tt=cell.value.richText[1].text;
                    var rptDate=getMonth("NA",cell);
                    toparsedate.rptDate=rptDate;
                }
            });
        }
        if(rowNumber>=5 && rowNumber<=45){
          row.eachCell({ includeEmpty: true }, function(cell, colNumber) {
                 if(colNumber==1){
                      console.log(">>>>><<<<<",cell.value);
                      if(cell.value){
                        desc="资产/"+cell.value.replace(" ","");
                      }else{
                        desc="资产/"+cell.value;
                      }
                  
                 }
                 if(colNumber==3 || colNumber==4){
                     if(desc!="资产/"){
                          var buildRow={};
                          buildRow.rpttypecode="NA";
                          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="NA";
                       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;
});



